<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE Trustworthy #-}</span><span>
</span><span id="line-2"></span><span class="hs-pragma">{-# LANGUAGE CPP, NoImplicitPrelude, CApiFFI #-}</span><span>
</span><span id="line-3"></span><span class="hs-pragma">{-# OPTIONS_HADDOCK not-home #-}</span><span>
</span><span id="line-4"></span><span>
</span><span id="line-5"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-6"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-7"></span><span class="hs-comment">-- Module      :  System.Posix.Internals</span><span>
</span><span id="line-8"></span><span class="hs-comment">-- Copyright   :  (c) The University of Glasgow, 1992-2002</span><span>
</span><span id="line-9"></span><span class="hs-comment">-- License     :  see libraries/base/LICENSE</span><span>
</span><span id="line-10"></span><span class="hs-comment">--</span><span>
</span><span id="line-11"></span><span class="hs-comment">-- Maintainer  :  cvs-ghc@haskell.org</span><span>
</span><span id="line-12"></span><span class="hs-comment">-- Stability   :  internal</span><span>
</span><span id="line-13"></span><span class="hs-comment">-- Portability :  non-portable (requires POSIX)</span><span>
</span><span id="line-14"></span><span class="hs-comment">--</span><span>
</span><span id="line-15"></span><span class="hs-comment">-- POSIX support layer for the standard libraries.</span><span>
</span><span id="line-16"></span><span class="hs-comment">-- This library is built on *every* platform, including Win32.</span><span>
</span><span id="line-17"></span><span class="hs-comment">--</span><span>
</span><span id="line-18"></span><span class="hs-comment">-- Non-posix compliant in order to support the following features:</span><span>
</span><span id="line-19"></span><span class="hs-comment">--      * S_ISSOCK (no sockets in POSIX)</span><span>
</span><span id="line-20"></span><span class="hs-comment">--</span><span>
</span><span id="line-21"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-22"></span><span>
</span><span id="line-23"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">System.Posix.Internals</span><span> </span><span class="hs-keyword">where</span><span class="hs-cpp">

#include &quot;HsBaseConfig.h&quot;
</span><span>
</span><span id="line-27"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="System.Posix.Types.html"><span class="hs-identifier">System.Posix.Types</span></a></span><span>
</span><span id="line-28"></span><span>
</span><span id="line-29"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Foreign.html"><span class="hs-identifier">Foreign</span></a></span><span>
</span><span id="line-30"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Foreign.C.html"><span class="hs-identifier">Foreign.C</span></a></span><span>
</span><span id="line-31"></span><span>
</span><span id="line-32"></span><span class="hs-comment">-- import Data.Bits</span><span>
</span><span id="line-33"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Maybe.html"><span class="hs-identifier">Data.Maybe</span></a></span><span class="hs-cpp">

#if !defined(HTYPE_TCFLAG_T)
</span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="System.IO.Error.html"><span class="hs-identifier">System.IO.Error</span></a></span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-39"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Base.html"><span class="hs-identifier">GHC.Base</span></a></span><span>
</span><span id="line-40"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Num.html"><span class="hs-identifier">GHC.Num</span></a></span><span>
</span><span id="line-41"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Real.html"><span class="hs-identifier">GHC.Real</span></a></span><span>
</span><span id="line-42"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.IO.html"><span class="hs-identifier">GHC.IO</span></a></span><span>
</span><span id="line-43"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.IO.IOMode.html"><span class="hs-identifier">GHC.IO.IOMode</span></a></span><span>
</span><span id="line-44"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.IO.Exception.html"><span class="hs-identifier">GHC.IO.Exception</span></a></span><span>
</span><span id="line-45"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.IO.Device.html"><span class="hs-identifier">GHC.IO.Device</span></a></span><span class="hs-cpp">
#if !defined(mingw32_HOST_OS)
</span><span class="hs-keyword">import</span><span> </span><span class="hs-pragma">{-# SOURCE</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="hs-identifier">GHC.IO.Encoding</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">getFileSystemEncoding</span><span class="hs-special">)</span><span>
</span><span id="line-48"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="hs-identifier">GHC.Foreign</span><span> </span><span class="hs-keyword">as</span><span> </span><span class="hs-identifier">GHC</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-51"></span><span class="hs-comment">-- ---------------------------------------------------------------------------</span><span>
</span><span id="line-52"></span><span class="hs-comment">-- Debugging the base package</span><span>
</span><span id="line-53"></span><span>
</span><span id="line-54"></span><span class="annot"><a href="System.Posix.Internals.html#puts"><span class="hs-identifier hs-type">puts</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-55"></span><span id="puts"><span class="annot"><span class="annottext">puts :: String -&gt; IO ()
</span><a href="System.Posix.Internals.html#puts"><span class="hs-identifier hs-var hs-var">puts</span></a></span></span><span> </span><span id="local-6989586621679547474"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679547474"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; (CStringLen -&gt; IO ()) -&gt; IO ()
forall a. String -&gt; (CStringLen -&gt; IO a) -&gt; IO a
</span><a href="Foreign.C.String.html#withCAStringLen"><span class="hs-identifier hs-var">withCAStringLen</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679547474"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;\n&quot;</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">((CStringLen -&gt; IO ()) -&gt; IO ()) -&gt; (CStringLen -&gt; IO ()) -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span class="hs-special">(</span><span id="local-6989586621679547472"><span class="annot"><span class="annottext">Ptr CChar
</span><a href="#local-6989586621679547472"><span class="hs-identifier hs-var">p</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679547471"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679547471"><span class="hs-identifier hs-var">len</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-56"></span><span>            </span><span class="hs-comment">-- In reality should be withCString, but assume ASCII to avoid loop</span><span>
</span><span id="line-57"></span><span>            </span><span class="hs-comment">-- if this is called by GHC.Foreign</span><span>
</span><span id="line-58"></span><span>           </span><span class="annot"><span class="annottext">CInt
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CInt -&gt; Ptr Word8 -&gt; CUInt -&gt; IO CInt
</span><a href="System.Posix.Internals.html#c_write"><span class="hs-identifier hs-var">c_write</span></a></span><span> </span><span class="annot"><span class="annottext">CInt
</span><span class="hs-number">1</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Ptr CChar -&gt; Ptr Word8
forall a b. Ptr a -&gt; Ptr b
</span><a href="GHC.Ptr.html#castPtr"><span class="hs-identifier hs-var">castPtr</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr CChar
</span><a href="#local-6989586621679547472"><span class="hs-identifier hs-var">p</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; CUInt
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679547471"><span class="hs-identifier hs-var">len</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-59"></span><span>           </span><span class="annot"><span class="annottext">() -&gt; IO ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-60"></span><span>
</span><span id="line-61"></span><span>
</span><span id="line-62"></span><span class="hs-comment">-- ---------------------------------------------------------------------------</span><span>
</span><span id="line-63"></span><span class="hs-comment">-- Types</span><span>
</span><span id="line-64"></span><span>
</span><span id="line-65"></span><span class="hs-keyword">data</span><span> </span><span class="hs-pragma">{-# CTYPE</span><span> </span><span class="hs-pragma">&quot;struct flock&quot;</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span id="CFLock"><span class="annot"><a href="System.Posix.Internals.html#CFLock"><span class="hs-identifier hs-var">CFLock</span></a></span></span><span>
</span><span id="line-66"></span><span class="hs-keyword">data</span><span> </span><span class="hs-pragma">{-# CTYPE</span><span> </span><span class="hs-pragma">&quot;struct group&quot;</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span id="CGroup"><span class="annot"><a href="System.Posix.Internals.html#CGroup"><span class="hs-identifier hs-var">CGroup</span></a></span></span><span>
</span><span id="line-67"></span><span class="hs-keyword">data</span><span> </span><span class="hs-pragma">{-# CTYPE</span><span> </span><span class="hs-pragma">&quot;struct lconv&quot;</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span id="CLconv"><span class="annot"><a href="System.Posix.Internals.html#CLconv"><span class="hs-identifier hs-var">CLconv</span></a></span></span><span>
</span><span id="line-68"></span><span class="hs-keyword">data</span><span> </span><span class="hs-pragma">{-# CTYPE</span><span> </span><span class="hs-pragma">&quot;struct passwd&quot;</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span id="CPasswd"><span class="annot"><a href="System.Posix.Internals.html#CPasswd"><span class="hs-identifier hs-var">CPasswd</span></a></span></span><span>
</span><span id="line-69"></span><span class="hs-keyword">data</span><span> </span><span class="hs-pragma">{-# CTYPE</span><span> </span><span class="hs-pragma">&quot;struct sigaction&quot;</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span id="CSigaction"><span class="annot"><a href="System.Posix.Internals.html#CSigaction"><span class="hs-identifier hs-var">CSigaction</span></a></span></span><span>
</span><span id="line-70"></span><span class="hs-keyword">data</span><span> </span><span class="hs-pragma">{-# CTYPE</span><span> </span><span class="hs-pragma">&quot;sigset_t&quot;</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span id="CSigset"><span class="annot"><a href="System.Posix.Internals.html#CSigset"><span class="hs-identifier hs-var">CSigset</span></a></span></span><span>
</span><span id="line-71"></span><span class="hs-keyword">data</span><span> </span><span class="hs-pragma">{-# CTYPE</span><span> </span><span class="hs-pragma">&quot;struct stat&quot;</span><span> </span><span class="hs-pragma">#-}</span><span>  </span><span id="CStat"><span class="annot"><a href="System.Posix.Internals.html#CStat"><span class="hs-identifier hs-var">CStat</span></a></span></span><span>
</span><span id="line-72"></span><span class="hs-keyword">data</span><span> </span><span class="hs-pragma">{-# CTYPE</span><span> </span><span class="hs-pragma">&quot;struct termios&quot;</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span id="CTermios"><span class="annot"><a href="System.Posix.Internals.html#CTermios"><span class="hs-identifier hs-var">CTermios</span></a></span></span><span>
</span><span id="line-73"></span><span class="hs-keyword">data</span><span> </span><span class="hs-pragma">{-# CTYPE</span><span> </span><span class="hs-pragma">&quot;struct tm&quot;</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span id="CTm"><span class="annot"><a href="System.Posix.Internals.html#CTm"><span class="hs-identifier hs-var">CTm</span></a></span></span><span>
</span><span id="line-74"></span><span class="hs-keyword">data</span><span> </span><span class="hs-pragma">{-# CTYPE</span><span> </span><span class="hs-pragma">&quot;struct tms&quot;</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span id="CTms"><span class="annot"><a href="System.Posix.Internals.html#CTms"><span class="hs-identifier hs-var">CTms</span></a></span></span><span>
</span><span id="line-75"></span><span class="hs-keyword">data</span><span> </span><span class="hs-pragma">{-# CTYPE</span><span> </span><span class="hs-pragma">&quot;struct utimbuf&quot;</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span id="CUtimbuf"><span class="annot"><a href="System.Posix.Internals.html#CUtimbuf"><span class="hs-identifier hs-var">CUtimbuf</span></a></span></span><span>
</span><span id="line-76"></span><span class="hs-keyword">data</span><span> </span><span class="hs-pragma">{-# CTYPE</span><span> </span><span class="hs-pragma">&quot;struct utsname&quot;</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span id="CUtsname"><span class="annot"><a href="System.Posix.Internals.html#CUtsname"><span class="hs-identifier hs-var">CUtsname</span></a></span></span><span>
</span><span id="line-77"></span><span>
</span><span id="line-78"></span><span class="hs-keyword">type</span><span> </span><span id="FD"><span class="annot"><a href="System.Posix.Internals.html#FD"><span class="hs-identifier hs-var">FD</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-79"></span><span>
</span><span id="line-80"></span><span class="hs-comment">-- ---------------------------------------------------------------------------</span><span>
</span><span id="line-81"></span><span class="hs-comment">-- stat()-related stuff</span><span>
</span><span id="line-82"></span><span>
</span><span id="line-83"></span><span class="annot"><a href="System.Posix.Internals.html#fdFileSize"><span class="hs-identifier hs-type">fdFileSize</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="System.Posix.Internals.html#FD"><span class="hs-identifier hs-type">FD</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Integer.html#Integer"><span class="hs-identifier hs-type">Integer</span></a></span><span>
</span><span id="line-84"></span><span id="fdFileSize"><span class="annot"><span class="annottext">fdFileSize :: CInt -&gt; IO Integer
</span><a href="System.Posix.Internals.html#fdFileSize"><span class="hs-identifier hs-var hs-var">fdFileSize</span></a></span></span><span> </span><span id="local-6989586621679547455"><span class="annot"><span class="annottext">CInt
</span><a href="#local-6989586621679547455"><span class="hs-identifier hs-var">fd</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-85"></span><span>  </span><span class="annot"><span class="annottext">Int -&gt; (Ptr CStat -&gt; IO Integer) -&gt; IO Integer
forall a b. Int -&gt; (Ptr a -&gt; IO b) -&gt; IO b
</span><a href="Foreign.Marshal.Alloc.html#allocaBytes"><span class="hs-identifier hs-var">allocaBytes</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="System.Posix.Internals.html#sizeof_stat"><span class="hs-identifier hs-var">sizeof_stat</span></a></span><span> </span><span class="annot"><span class="annottext">((Ptr CStat -&gt; IO Integer) -&gt; IO Integer)
-&gt; (Ptr CStat -&gt; IO Integer) -&gt; IO Integer
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679547452"><span class="annot"><span class="annottext">Ptr CStat
</span><a href="#local-6989586621679547452"><span class="hs-identifier hs-var">p_stat</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-86"></span><span>    </span><span class="annot"><span class="annottext">String -&gt; IO CInt -&gt; IO ()
forall a. (Eq a, Num a) =&gt; String -&gt; IO a -&gt; IO ()
</span><a href="Foreign.C.Error.html#throwErrnoIfMinus1Retry_"><span class="hs-identifier hs-var">throwErrnoIfMinus1Retry_</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;fileSize&quot;</span></span><span> </span><span class="annot"><span class="annottext">(IO CInt -&gt; IO ()) -&gt; IO CInt -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-87"></span><span>        </span><span class="annot"><span class="annottext">CInt -&gt; Ptr CStat -&gt; IO CInt
</span><a href="System.Posix.Internals.html#c_fstat"><span class="hs-identifier hs-var">c_fstat</span></a></span><span> </span><span class="annot"><span class="annottext">CInt
</span><a href="#local-6989586621679547455"><span class="hs-identifier hs-var">fd</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr CStat
</span><a href="#local-6989586621679547452"><span class="hs-identifier hs-var">p_stat</span></a></span><span>
</span><span id="line-88"></span><span>    </span><span id="local-6989586621679547449"><span class="annot"><span class="annottext">CMode
</span><a href="#local-6989586621679547449"><span class="hs-identifier hs-var">c_mode</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Ptr CStat -&gt; IO CMode
</span><a href="System.Posix.Internals.html#st_mode"><span class="hs-identifier hs-var">st_mode</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr CStat
</span><a href="#local-6989586621679547452"><span class="hs-identifier hs-var">p_stat</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="System.Posix.Types.html#CMode"><span class="hs-identifier hs-type">CMode</span></a></span><span>
</span><span id="line-89"></span><span>    </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#not"><span class="hs-identifier hs-var">not</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CMode -&gt; Bool
</span><a href="System.Posix.Internals.html#s_isreg"><span class="hs-identifier hs-var">s_isreg</span></a></span><span> </span><span class="annot"><span class="annottext">CMode
</span><a href="#local-6989586621679547449"><span class="hs-identifier hs-var">c_mode</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-90"></span><span>        </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; IO Integer
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">-</span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>
</span><span id="line-91"></span><span>        </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-92"></span><span>      </span><span id="local-6989586621679547445"><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679547445"><span class="hs-identifier hs-var">c_size</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Ptr CStat -&gt; IO Int64
</span><a href="System.Posix.Internals.html#st_size"><span class="hs-identifier hs-var">st_size</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr CStat
</span><a href="#local-6989586621679547452"><span class="hs-identifier hs-var">p_stat</span></a></span><span>
</span><span id="line-93"></span><span>      </span><span class="annot"><span class="annottext">Integer -&gt; IO Integer
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int64 -&gt; Integer
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679547445"><span class="hs-identifier hs-var">c_size</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-94"></span><span>
</span><span id="line-95"></span><span class="annot"><a href="System.Posix.Internals.html#fileType"><span class="hs-identifier hs-type">fileType</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="GHC.IO.Device.html#IODeviceType"><span class="hs-identifier hs-type">IODeviceType</span></a></span><span>
</span><span id="line-96"></span><span id="fileType"><span class="annot"><span class="annottext">fileType :: String -&gt; IO IODeviceType
</span><a href="System.Posix.Internals.html#fileType"><span class="hs-identifier hs-var hs-var">fileType</span></a></span></span><span> </span><span id="local-6989586621679547441"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679547441"><span class="hs-identifier hs-var">file</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-97"></span><span>  </span><span class="annot"><span class="annottext">Int -&gt; (Ptr CStat -&gt; IO IODeviceType) -&gt; IO IODeviceType
forall a b. Int -&gt; (Ptr a -&gt; IO b) -&gt; IO b
</span><a href="Foreign.Marshal.Alloc.html#allocaBytes"><span class="hs-identifier hs-var">allocaBytes</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="System.Posix.Internals.html#sizeof_stat"><span class="hs-identifier hs-var">sizeof_stat</span></a></span><span> </span><span class="annot"><span class="annottext">((Ptr CStat -&gt; IO IODeviceType) -&gt; IO IODeviceType)
-&gt; (Ptr CStat -&gt; IO IODeviceType) -&gt; IO IODeviceType
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679547440"><span class="annot"><span class="annottext">Ptr CStat
</span><a href="#local-6989586621679547440"><span class="hs-identifier hs-var">p_stat</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-98"></span><span>  </span><span class="annot"><span class="annottext">String -&gt; (CWString -&gt; IO IODeviceType) -&gt; IO IODeviceType
forall a. String -&gt; (CWString -&gt; IO a) -&gt; IO a
</span><a href="System.Posix.Internals.html#withFilePath"><span class="hs-identifier hs-var">withFilePath</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679547441"><span class="hs-identifier hs-var">file</span></a></span><span> </span><span class="annot"><span class="annottext">((CWString -&gt; IO IODeviceType) -&gt; IO IODeviceType)
-&gt; (CWString -&gt; IO IODeviceType) -&gt; IO IODeviceType
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679547438"><span class="annot"><span class="annottext">CWString
</span><a href="#local-6989586621679547438"><span class="hs-identifier hs-var">p_file</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-99"></span><span>    </span><span class="annot"><span class="annottext">String -&gt; IO CInt -&gt; IO ()
forall a. (Eq a, Num a) =&gt; String -&gt; IO a -&gt; IO ()
</span><a href="Foreign.C.Error.html#throwErrnoIfMinus1Retry_"><span class="hs-identifier hs-var">throwErrnoIfMinus1Retry_</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;fileType&quot;</span></span><span> </span><span class="annot"><span class="annottext">(IO CInt -&gt; IO ()) -&gt; IO CInt -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-100"></span><span>      </span><span class="annot"><span class="annottext">CWString -&gt; Ptr CStat -&gt; IO CInt
</span><a href="System.Posix.Internals.html#c_stat"><span class="hs-identifier hs-var">c_stat</span></a></span><span> </span><span class="annot"><span class="annottext">CWString
</span><a href="#local-6989586621679547438"><span class="hs-identifier hs-var">p_file</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr CStat
</span><a href="#local-6989586621679547440"><span class="hs-identifier hs-var">p_stat</span></a></span><span>
</span><span id="line-101"></span><span>    </span><span class="annot"><span class="annottext">Ptr CStat -&gt; IO IODeviceType
</span><a href="System.Posix.Internals.html#statGetType"><span class="hs-identifier hs-var">statGetType</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr CStat
</span><a href="#local-6989586621679547440"><span class="hs-identifier hs-var">p_stat</span></a></span><span>
</span><span id="line-102"></span><span>
</span><span id="line-103"></span><span class="hs-comment">-- NOTE: On Win32 platforms, this will only work with file descriptors</span><span>
</span><span id="line-104"></span><span class="hs-comment">-- referring to file handles. i.e., it'll fail for socket FDs.</span><span>
</span><span id="line-105"></span><span class="annot"><a href="System.Posix.Internals.html#fdStat"><span class="hs-identifier hs-type">fdStat</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="System.Posix.Internals.html#FD"><span class="hs-identifier hs-type">FD</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.IO.Device.html#IODeviceType"><span class="hs-identifier hs-type">IODeviceType</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="System.Posix.Types.html#CDev"><span class="hs-identifier hs-type">CDev</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="System.Posix.Types.html#CIno"><span class="hs-identifier hs-type">CIno</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-106"></span><span id="fdStat"><span class="annot"><span class="annottext">fdStat :: CInt -&gt; IO (IODeviceType, CDev, CIno)
</span><a href="System.Posix.Internals.html#fdStat"><span class="hs-identifier hs-var hs-var">fdStat</span></a></span></span><span> </span><span id="local-6989586621679547434"><span class="annot"><span class="annottext">CInt
</span><a href="#local-6989586621679547434"><span class="hs-identifier hs-var">fd</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-107"></span><span>  </span><span class="annot"><span class="annottext">Int
-&gt; (Ptr CStat -&gt; IO (IODeviceType, CDev, CIno))
-&gt; IO (IODeviceType, CDev, CIno)
forall a b. Int -&gt; (Ptr a -&gt; IO b) -&gt; IO b
</span><a href="Foreign.Marshal.Alloc.html#allocaBytes"><span class="hs-identifier hs-var">allocaBytes</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="System.Posix.Internals.html#sizeof_stat"><span class="hs-identifier hs-var">sizeof_stat</span></a></span><span> </span><span class="annot"><span class="annottext">((Ptr CStat -&gt; IO (IODeviceType, CDev, CIno))
 -&gt; IO (IODeviceType, CDev, CIno))
-&gt; (Ptr CStat -&gt; IO (IODeviceType, CDev, CIno))
-&gt; IO (IODeviceType, CDev, CIno)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679547433"><span class="annot"><span class="annottext">Ptr CStat
</span><a href="#local-6989586621679547433"><span class="hs-identifier hs-var">p_stat</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-108"></span><span>    </span><span class="annot"><span class="annottext">String -&gt; IO CInt -&gt; IO ()
forall a. (Eq a, Num a) =&gt; String -&gt; IO a -&gt; IO ()
</span><a href="Foreign.C.Error.html#throwErrnoIfMinus1Retry_"><span class="hs-identifier hs-var">throwErrnoIfMinus1Retry_</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;fdType&quot;</span></span><span> </span><span class="annot"><span class="annottext">(IO CInt -&gt; IO ()) -&gt; IO CInt -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-109"></span><span>        </span><span class="annot"><span class="annottext">CInt -&gt; Ptr CStat -&gt; IO CInt
</span><a href="System.Posix.Internals.html#c_fstat"><span class="hs-identifier hs-var">c_fstat</span></a></span><span> </span><span class="annot"><span class="annottext">CInt
</span><a href="#local-6989586621679547434"><span class="hs-identifier hs-var">fd</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr CStat
</span><a href="#local-6989586621679547433"><span class="hs-identifier hs-var">p_stat</span></a></span><span>
</span><span id="line-110"></span><span>    </span><span id="local-6989586621679547432"><span class="annot"><span class="annottext">IODeviceType
</span><a href="#local-6989586621679547432"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Ptr CStat -&gt; IO IODeviceType
</span><a href="System.Posix.Internals.html#statGetType"><span class="hs-identifier hs-var">statGetType</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr CStat
</span><a href="#local-6989586621679547433"><span class="hs-identifier hs-var">p_stat</span></a></span><span>
</span><span id="line-111"></span><span>    </span><span id="local-6989586621679547431"><span class="annot"><span class="annottext">CDev
</span><a href="#local-6989586621679547431"><span class="hs-identifier hs-var">dev</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Ptr CStat -&gt; IO CDev
</span><a href="System.Posix.Internals.html#st_dev"><span class="hs-identifier hs-var">st_dev</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr CStat
</span><a href="#local-6989586621679547433"><span class="hs-identifier hs-var">p_stat</span></a></span><span>
</span><span id="line-112"></span><span>    </span><span id="local-6989586621679547429"><span class="annot"><span class="annottext">CIno
</span><a href="#local-6989586621679547429"><span class="hs-identifier hs-var">ino</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Ptr CStat -&gt; IO CIno
</span><a href="System.Posix.Internals.html#st_ino"><span class="hs-identifier hs-var">st_ino</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr CStat
</span><a href="#local-6989586621679547433"><span class="hs-identifier hs-var">p_stat</span></a></span><span>
</span><span id="line-113"></span><span>    </span><span class="annot"><span class="annottext">(IODeviceType, CDev, CIno) -&gt; IO (IODeviceType, CDev, CIno)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IODeviceType
</span><a href="#local-6989586621679547432"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">CDev
</span><a href="#local-6989586621679547431"><span class="hs-identifier hs-var">dev</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">CIno
</span><a href="#local-6989586621679547429"><span class="hs-identifier hs-var">ino</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-114"></span><span>
</span><span id="line-115"></span><span class="annot"><a href="System.Posix.Internals.html#fdType"><span class="hs-identifier hs-type">fdType</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="System.Posix.Internals.html#FD"><span class="hs-identifier hs-type">FD</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="GHC.IO.Device.html#IODeviceType"><span class="hs-identifier hs-type">IODeviceType</span></a></span><span>
</span><span id="line-116"></span><span id="fdType"><span class="annot"><span class="annottext">fdType :: CInt -&gt; IO IODeviceType
</span><a href="System.Posix.Internals.html#fdType"><span class="hs-identifier hs-var hs-var">fdType</span></a></span></span><span> </span><span id="local-6989586621679547426"><span class="annot"><span class="annottext">CInt
</span><a href="#local-6989586621679547426"><span class="hs-identifier hs-var">fd</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679547425"><span class="annot"><span class="annottext">IODeviceType
</span><a href="#local-6989586621679547425"><span class="hs-identifier hs-var">ty</span></a></span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">CDev
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">CIno
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CInt -&gt; IO (IODeviceType, CDev, CIno)
</span><a href="System.Posix.Internals.html#fdStat"><span class="hs-identifier hs-var">fdStat</span></a></span><span> </span><span class="annot"><span class="annottext">CInt
</span><a href="#local-6989586621679547426"><span class="hs-identifier hs-var">fd</span></a></span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">IODeviceType -&gt; IO IODeviceType
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">IODeviceType
</span><a href="#local-6989586621679547425"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-117"></span><span>
</span><span id="line-118"></span><span class="annot"><a href="System.Posix.Internals.html#statGetType"><span class="hs-identifier hs-type">statGetType</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="System.Posix.Internals.html#CStat"><span class="hs-identifier hs-type">CStat</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="GHC.IO.Device.html#IODeviceType"><span class="hs-identifier hs-type">IODeviceType</span></a></span><span>
</span><span id="line-119"></span><span id="statGetType"><span class="annot"><span class="annottext">statGetType :: Ptr CStat -&gt; IO IODeviceType
</span><a href="System.Posix.Internals.html#statGetType"><span class="hs-identifier hs-var hs-var">statGetType</span></a></span></span><span> </span><span id="local-6989586621679547424"><span class="annot"><span class="annottext">Ptr CStat
</span><a href="#local-6989586621679547424"><span class="hs-identifier hs-var">p_stat</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-120"></span><span>  </span><span id="local-6989586621679547423"><span class="annot"><span class="annottext">CMode
</span><a href="#local-6989586621679547423"><span class="hs-identifier hs-var">c_mode</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Ptr CStat -&gt; IO CMode
</span><a href="System.Posix.Internals.html#st_mode"><span class="hs-identifier hs-var">st_mode</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr CStat
</span><a href="#local-6989586621679547424"><span class="hs-identifier hs-var">p_stat</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="System.Posix.Types.html#CMode"><span class="hs-identifier hs-type">CMode</span></a></span><span>
</span><span id="line-121"></span><span>  </span><span class="hs-keyword">case</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-122"></span><span>      </span><span class="annot"><span class="annottext">()
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">CMode -&gt; Bool
</span><a href="System.Posix.Internals.html#s_isdir"><span class="hs-identifier hs-var">s_isdir</span></a></span><span> </span><span class="annot"><span class="annottext">CMode
</span><a href="#local-6989586621679547423"><span class="hs-identifier hs-var">c_mode</span></a></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">IODeviceType -&gt; IO IODeviceType
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">IODeviceType
</span><a href="GHC.IO.Device.html#Directory"><span class="hs-identifier hs-var">Directory</span></a></span><span>
</span><span id="line-123"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">CMode -&gt; Bool
</span><a href="System.Posix.Internals.html#s_isfifo"><span class="hs-identifier hs-var">s_isfifo</span></a></span><span> </span><span class="annot"><span class="annottext">CMode
</span><a href="#local-6989586621679547423"><span class="hs-identifier hs-var">c_mode</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%7C%7C"><span class="hs-operator hs-var">||</span></a></span><span> </span><span class="annot"><span class="annottext">CMode -&gt; Bool
</span><a href="System.Posix.Internals.html#s_issock"><span class="hs-identifier hs-var">s_issock</span></a></span><span> </span><span class="annot"><span class="annottext">CMode
</span><a href="#local-6989586621679547423"><span class="hs-identifier hs-var">c_mode</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%7C%7C"><span class="hs-operator hs-var">||</span></a></span><span> </span><span class="annot"><span class="annottext">CMode -&gt; Bool
</span><a href="System.Posix.Internals.html#s_ischr"><span class="hs-identifier hs-var">s_ischr</span></a></span><span>  </span><span class="annot"><span class="annottext">CMode
</span><a href="#local-6989586621679547423"><span class="hs-identifier hs-var">c_mode</span></a></span><span>
</span><span id="line-124"></span><span>                                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">IODeviceType -&gt; IO IODeviceType
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">IODeviceType
</span><a href="GHC.IO.Device.html#Stream"><span class="hs-identifier hs-var">Stream</span></a></span><span>
</span><span id="line-125"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">CMode -&gt; Bool
</span><a href="System.Posix.Internals.html#s_isreg"><span class="hs-identifier hs-var">s_isreg</span></a></span><span> </span><span class="annot"><span class="annottext">CMode
</span><a href="#local-6989586621679547423"><span class="hs-identifier hs-var">c_mode</span></a></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">IODeviceType -&gt; IO IODeviceType
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">IODeviceType
</span><a href="GHC.IO.Device.html#RegularFile"><span class="hs-identifier hs-var">RegularFile</span></a></span><span>
</span><span id="line-126"></span><span>         </span><span class="hs-comment">-- Q: map char devices to RawDevice too?</span><span>
</span><span id="line-127"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">CMode -&gt; Bool
</span><a href="System.Posix.Internals.html#s_isblk"><span class="hs-identifier hs-var">s_isblk</span></a></span><span> </span><span class="annot"><span class="annottext">CMode
</span><a href="#local-6989586621679547423"><span class="hs-identifier hs-var">c_mode</span></a></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">IODeviceType -&gt; IO IODeviceType
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">IODeviceType
</span><a href="GHC.IO.Device.html#RawDevice"><span class="hs-identifier hs-var">RawDevice</span></a></span><span>
</span><span id="line-128"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">IOError -&gt; IO IODeviceType
forall a. IOError -&gt; IO a
</span><a href="GHC.IO.Exception.html#ioError"><span class="hs-identifier hs-var">ioError</span></a></span><span> </span><span class="annot"><span class="annottext">IOError
</span><a href="System.Posix.Internals.html#ioe_unknownfiletype"><span class="hs-identifier hs-var">ioe_unknownfiletype</span></a></span><span>
</span><span id="line-129"></span><span>
</span><span id="line-130"></span><span class="annot"><a href="System.Posix.Internals.html#ioe_unknownfiletype"><span class="hs-identifier hs-type">ioe_unknownfiletype</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.IO.Exception.html#IOException"><span class="hs-identifier hs-type">IOException</span></a></span><span>
</span><span id="line-131"></span><span id="ioe_unknownfiletype"><span class="annot"><span class="annottext">ioe_unknownfiletype :: IOError
</span><a href="System.Posix.Internals.html#ioe_unknownfiletype"><span class="hs-identifier hs-var hs-var">ioe_unknownfiletype</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe Handle
-&gt; IOErrorType
-&gt; String
-&gt; String
-&gt; Maybe CInt
-&gt; Maybe String
-&gt; IOError
</span><a href="GHC.IO.Exception.html#IOError"><span class="hs-identifier hs-var">IOError</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Handle
forall a. Maybe a
</span><a href="GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="annot"><span class="annottext">IOErrorType
</span><a href="GHC.IO.Exception.html#UnsupportedOperation"><span class="hs-identifier hs-var">UnsupportedOperation</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;fdType&quot;</span></span><span>
</span><span id="line-132"></span><span>                        </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;unknown file type&quot;</span></span><span>
</span><span id="line-133"></span><span>                        </span><span class="annot"><span class="annottext">Maybe CInt
forall a. Maybe a
</span><a href="GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-134"></span><span>                        </span><span class="annot"><span class="annottext">Maybe String
forall a. Maybe a
</span><a href="GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-135"></span><span>
</span><span id="line-136"></span><span class="annot"><a href="System.Posix.Internals.html#fdGetMode"><span class="hs-identifier hs-type">fdGetMode</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="System.Posix.Internals.html#FD"><span class="hs-identifier hs-type">FD</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="GHC.IO.IOMode.html#IOMode"><span class="hs-identifier hs-type">IOMode</span></a></span><span class="hs-cpp">
#if defined(mingw32_HOST_OS)
</span><span id="fdGetMode"><span class="annot"><span class="annottext">fdGetMode :: CInt -&gt; IO IOMode
</span><a href="System.Posix.Internals.html#fdGetMode"><span class="hs-identifier hs-var hs-var">fdGetMode</span></a></span></span><span> </span><span class="annot"><span class="annottext">CInt
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-139"></span><span>    </span><span class="hs-comment">-- We don't have a way of finding out which flags are set on FDs</span><span>
</span><span id="line-140"></span><span>    </span><span class="hs-comment">-- on Windows, so make a handle that thinks that anything goes.</span><span>
</span><span id="line-141"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679547406"><span class="annot"><span class="annottext">flags :: CInt
</span><a href="#local-6989586621679547406"><span class="hs-identifier hs-var hs-var">flags</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CInt
</span><a href="System.Posix.Internals.html#o_RDWR"><span class="hs-identifier hs-var">o_RDWR</span></a></span><span class="hs-cpp">
#else
</span><span class="hs-identifier">fdGetMode</span><span> </span><span class="hs-identifier">fd</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-144"></span><span>    </span><span class="hs-identifier">flags</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">throwErrnoIfMinus1Retry</span><span> </span><span class="hs-string">&quot;fdGetMode&quot;</span><span>
</span><span id="line-145"></span><span>                </span><span class="hs-special">(</span><span class="hs-identifier">c_fcntl_read</span><span> </span><span class="hs-identifier">fd</span><span> </span><span class="hs-identifier">const_f_getfl</span><span class="hs-special">)</span><span class="hs-cpp">
#endif
</span><span>    </span><span class="hs-keyword">let</span><span>
</span><span id="line-148"></span><span>       </span><span id="local-6989586621679547400"><span class="annot"><span class="annottext">wH :: Bool
</span><a href="#local-6989586621679547400"><span class="hs-identifier hs-var hs-var">wH</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CInt
</span><a href="#local-6989586621679547406"><span class="hs-identifier hs-var">flags</span></a></span><span> </span><span class="annot"><span class="annottext">CInt -&gt; CInt -&gt; CInt
forall a. Bits a =&gt; a -&gt; a -&gt; a
</span><a href="Data.Bits.html#.%26."><span class="hs-operator hs-var">.&amp;.</span></a></span><span> </span><span class="annot"><span class="annottext">CInt
</span><a href="System.Posix.Internals.html#o_WRONLY"><span class="hs-identifier hs-var">o_WRONLY</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">CInt -&gt; CInt -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%2F%3D"><span class="hs-operator hs-var">/=</span></a></span><span> </span><span class="annot"><span class="annottext">CInt
</span><span class="hs-number">0</span></span><span>
</span><span id="line-149"></span><span>       </span><span id="local-6989586621679547393"><span class="annot"><span class="annottext">aH :: Bool
</span><a href="#local-6989586621679547393"><span class="hs-identifier hs-var hs-var">aH</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CInt
</span><a href="#local-6989586621679547406"><span class="hs-identifier hs-var">flags</span></a></span><span> </span><span class="annot"><span class="annottext">CInt -&gt; CInt -&gt; CInt
forall a. Bits a =&gt; a -&gt; a -&gt; a
</span><a href="Data.Bits.html#.%26."><span class="hs-operator hs-var">.&amp;.</span></a></span><span> </span><span class="annot"><span class="annottext">CInt
</span><a href="System.Posix.Internals.html#o_APPEND"><span class="hs-identifier hs-var">o_APPEND</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">CInt -&gt; CInt -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%2F%3D"><span class="hs-operator hs-var">/=</span></a></span><span> </span><span class="annot"><span class="annottext">CInt
</span><span class="hs-number">0</span></span><span>
</span><span id="line-150"></span><span>       </span><span id="local-6989586621679547388"><span class="annot"><span class="annottext">rwH :: Bool
</span><a href="#local-6989586621679547388"><span class="hs-identifier hs-var hs-var">rwH</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CInt
</span><a href="#local-6989586621679547406"><span class="hs-identifier hs-var">flags</span></a></span><span> </span><span class="annot"><span class="annottext">CInt -&gt; CInt -&gt; CInt
forall a. Bits a =&gt; a -&gt; a -&gt; a
</span><a href="Data.Bits.html#.%26."><span class="hs-operator hs-var">.&amp;.</span></a></span><span> </span><span class="annot"><span class="annottext">CInt
</span><a href="System.Posix.Internals.html#o_RDWR"><span class="hs-identifier hs-var">o_RDWR</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">CInt -&gt; CInt -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%2F%3D"><span class="hs-operator hs-var">/=</span></a></span><span> </span><span class="annot"><span class="annottext">CInt
</span><span class="hs-number">0</span></span><span>
</span><span id="line-151"></span><span>
</span><span id="line-152"></span><span>       </span><span id="local-6989586621679547387"><span class="annot"><span class="annottext">mode :: IOMode
</span><a href="#local-6989586621679547387"><span class="hs-identifier hs-var hs-var">mode</span></a></span></span><span>
</span><span id="line-153"></span><span>         </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679547400"><span class="hs-identifier hs-var">wH</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator hs-var">&amp;&amp;</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679547393"><span class="hs-identifier hs-var">aH</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IOMode
</span><a href="GHC.IO.IOMode.html#AppendMode"><span class="hs-identifier hs-var">AppendMode</span></a></span><span>
</span><span id="line-154"></span><span>         </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679547400"><span class="hs-identifier hs-var">wH</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IOMode
</span><a href="GHC.IO.IOMode.html#WriteMode"><span class="hs-identifier hs-var">WriteMode</span></a></span><span>
</span><span id="line-155"></span><span>         </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679547388"><span class="hs-identifier hs-var">rwH</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IOMode
</span><a href="GHC.IO.IOMode.html#ReadWriteMode"><span class="hs-identifier hs-var">ReadWriteMode</span></a></span><span>
</span><span id="line-156"></span><span>         </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IOMode
</span><a href="GHC.IO.IOMode.html#ReadMode"><span class="hs-identifier hs-var">ReadMode</span></a></span><span>
</span><span id="line-157"></span><span>
</span><span id="line-158"></span><span>    </span><span class="annot"><span class="annottext">IOMode -&gt; IO IOMode
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">IOMode
</span><a href="#local-6989586621679547387"><span class="hs-identifier hs-var">mode</span></a></span><span class="hs-cpp">

#if defined(mingw32_HOST_OS)
</span><span id="local-6989586621679547559"><span class="annot"><a href="System.Posix.Internals.html#withFilePath"><span class="hs-identifier hs-type">withFilePath</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Foreign.C.String.html#CWString"><span class="hs-identifier hs-type">CWString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679547559"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679547559"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-162"></span><span id="withFilePath"><span class="annot"><span class="annottext">withFilePath :: forall a. String -&gt; (CWString -&gt; IO a) -&gt; IO a
</span><a href="System.Posix.Internals.html#withFilePath"><span class="hs-identifier hs-var hs-var">withFilePath</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; (CWString -&gt; IO a) -&gt; IO a
forall a. String -&gt; (CWString -&gt; IO a) -&gt; IO a
</span><a href="Foreign.C.String.html#withCWString"><span class="hs-identifier hs-var">withCWString</span></a></span><span>
</span><span id="line-163"></span><span>
</span><span id="line-164"></span><span class="annot"><a href="System.Posix.Internals.html#newFilePath"><span class="hs-identifier hs-type">newFilePath</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="Foreign.C.String.html#CWString"><span class="hs-identifier hs-type">CWString</span></a></span><span>
</span><span id="line-165"></span><span id="newFilePath"><span class="annot"><span class="annottext">newFilePath :: String -&gt; IO CWString
</span><a href="System.Posix.Internals.html#newFilePath"><span class="hs-identifier hs-var hs-var">newFilePath</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; IO CWString
</span><a href="Foreign.C.String.html#newCWString"><span class="hs-identifier hs-var">newCWString</span></a></span><span>
</span><span id="line-166"></span><span>
</span><span id="line-167"></span><span class="annot"><a href="System.Posix.Internals.html#peekFilePath"><span class="hs-identifier hs-type">peekFilePath</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.String.html#CWString"><span class="hs-identifier hs-type">CWString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span>
</span><span id="line-168"></span><span id="peekFilePath"><span class="annot"><span class="annottext">peekFilePath :: CWString -&gt; IO String
</span><a href="System.Posix.Internals.html#peekFilePath"><span class="hs-identifier hs-var hs-var">peekFilePath</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CWString -&gt; IO String
</span><a href="Foreign.C.String.html#peekCWString"><span class="hs-identifier hs-var">peekCWString</span></a></span><span class="hs-cpp">
#else
</span><span>
</span><span id="line-171"></span><span class="hs-identifier">withFilePath</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FilePath</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">CString</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">a</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">a</span><span>
</span><span id="line-172"></span><span class="hs-identifier">newFilePath</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FilePath</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">CString</span><span>
</span><span id="line-173"></span><span class="hs-identifier">peekFilePath</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">CString</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">FilePath</span><span>
</span><span id="line-174"></span><span class="hs-identifier">peekFilePathLen</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">CStringLen</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">FilePath</span><span>
</span><span id="line-175"></span><span>
</span><span id="line-176"></span><span class="hs-identifier">withFilePath</span><span> </span><span class="hs-identifier">fp</span><span> </span><span class="hs-identifier">f</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">getFileSystemEncoding</span><span> </span><span class="hs-operator">&gt;&gt;=</span><span> </span><span class="hs-glyph">\</span><span class="hs-identifier">enc</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">GHC.withCString</span><span> </span><span class="hs-identifier">enc</span><span> </span><span class="hs-identifier">fp</span><span> </span><span class="hs-identifier">f</span><span>
</span><span id="line-177"></span><span class="hs-identifier">newFilePath</span><span> </span><span class="hs-identifier">fp</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">getFileSystemEncoding</span><span> </span><span class="hs-operator">&gt;&gt;=</span><span> </span><span class="hs-glyph">\</span><span class="hs-identifier">enc</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">GHC.newCString</span><span> </span><span class="hs-identifier">enc</span><span> </span><span class="hs-identifier">fp</span><span>
</span><span id="line-178"></span><span class="hs-identifier">peekFilePath</span><span> </span><span class="hs-identifier">fp</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">getFileSystemEncoding</span><span> </span><span class="hs-operator">&gt;&gt;=</span><span> </span><span class="hs-glyph">\</span><span class="hs-identifier">enc</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">GHC.peekCString</span><span> </span><span class="hs-identifier">enc</span><span> </span><span class="hs-identifier">fp</span><span>
</span><span id="line-179"></span><span class="hs-identifier">peekFilePathLen</span><span> </span><span class="hs-identifier">fp</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">getFileSystemEncoding</span><span> </span><span class="hs-operator">&gt;&gt;=</span><span> </span><span class="hs-glyph">\</span><span class="hs-identifier">enc</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">GHC.peekCStringLen</span><span> </span><span class="hs-identifier">enc</span><span> </span><span class="hs-identifier">fp</span><span class="hs-cpp">

#endif
</span><span>
</span><span id="line-183"></span><span class="hs-comment">-- ---------------------------------------------------------------------------</span><span>
</span><span id="line-184"></span><span class="hs-comment">-- Terminal-related stuff</span><span class="hs-cpp">

#if defined(HTYPE_TCFLAG_T)
</span><span>
</span><span id="line-188"></span><span class="hs-identifier">setEcho</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Bool</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-189"></span><span class="hs-identifier">setEcho</span><span> </span><span class="hs-identifier">fd</span><span> </span><span class="hs-identifier">on</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-190"></span><span>  </span><span class="hs-identifier">tcSetAttr</span><span> </span><span class="hs-identifier">fd</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_tios</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-191"></span><span>    </span><span class="hs-identifier">lflag</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">c_lflag</span><span> </span><span class="hs-identifier">p_tios</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">CTcflag</span><span>
</span><span id="line-192"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span class="hs-identifier">new_lflag</span><span>
</span><span id="line-193"></span><span>         </span><span class="hs-glyph">|</span><span> </span><span class="hs-identifier">on</span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">lflag</span><span> </span><span class="hs-operator">.|.</span><span> </span><span class="hs-identifier">fromIntegral</span><span> </span><span class="hs-identifier">const_echo</span><span>
</span><span id="line-194"></span><span>         </span><span class="hs-glyph">|</span><span> </span><span class="hs-identifier">otherwise</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">lflag</span><span> </span><span class="hs-operator">.&amp;.</span><span> </span><span class="hs-identifier">complement</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">fromIntegral</span><span> </span><span class="hs-identifier">const_echo</span><span class="hs-special">)</span><span>
</span><span id="line-195"></span><span>    </span><span class="hs-identifier">poke_c_lflag</span><span> </span><span class="hs-identifier">p_tios</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">new_lflag</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">CTcflag</span><span class="hs-special">)</span><span>
</span><span id="line-196"></span><span>
</span><span id="line-197"></span><span class="hs-identifier">getEcho</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-198"></span><span class="hs-identifier">getEcho</span><span> </span><span class="hs-identifier">fd</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-199"></span><span>  </span><span class="hs-identifier">tcSetAttr</span><span> </span><span class="hs-identifier">fd</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_tios</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-200"></span><span>    </span><span class="hs-identifier">lflag</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">c_lflag</span><span> </span><span class="hs-identifier">p_tios</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">CTcflag</span><span>
</span><span id="line-201"></span><span>    </span><span class="hs-identifier">return</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-identifier">lflag</span><span> </span><span class="hs-operator">.&amp;.</span><span> </span><span class="hs-identifier">fromIntegral</span><span> </span><span class="hs-identifier">const_echo</span><span class="hs-special">)</span><span> </span><span class="hs-operator">/=</span><span> </span><span class="hs-number">0</span><span class="hs-special">)</span><span>
</span><span id="line-202"></span><span>
</span><span id="line-203"></span><span class="hs-identifier">setCooked</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Bool</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-204"></span><span class="hs-identifier">setCooked</span><span> </span><span class="hs-identifier">fd</span><span> </span><span class="hs-identifier">cooked</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-205"></span><span>  </span><span class="hs-identifier">tcSetAttr</span><span> </span><span class="hs-identifier">fd</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_tios</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-206"></span><span>
</span><span id="line-207"></span><span>    </span><span class="hs-comment">-- turn on/off ICANON</span><span>
</span><span id="line-208"></span><span>    </span><span class="hs-identifier">lflag</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">c_lflag</span><span> </span><span class="hs-identifier">p_tios</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">CTcflag</span><span>
</span><span id="line-209"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span class="hs-identifier">new_lflag</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="hs-identifier">cooked</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">lflag</span><span> </span><span class="hs-operator">.|.</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">fromIntegral</span><span> </span><span class="hs-identifier">const_icanon</span><span class="hs-special">)</span><span>
</span><span id="line-210"></span><span>                  </span><span class="hs-glyph">|</span><span> </span><span class="hs-identifier">otherwise</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">lflag</span><span> </span><span class="hs-operator">.&amp;.</span><span> </span><span class="hs-identifier">complement</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">fromIntegral</span><span> </span><span class="hs-identifier">const_icanon</span><span class="hs-special">)</span><span>
</span><span id="line-211"></span><span>    </span><span class="hs-identifier">poke_c_lflag</span><span> </span><span class="hs-identifier">p_tios</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">new_lflag</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">CTcflag</span><span class="hs-special">)</span><span>
</span><span id="line-212"></span><span>
</span><span id="line-213"></span><span>    </span><span class="hs-comment">-- set VMIN &amp; VTIME to 1/0 respectively</span><span>
</span><span id="line-214"></span><span>    </span><span class="hs-identifier">when</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">not</span><span> </span><span class="hs-identifier">cooked</span><span class="hs-special">)</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-215"></span><span>            </span><span class="hs-identifier">c_cc</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">ptr_c_cc</span><span> </span><span class="hs-identifier">p_tios</span><span>
</span><span id="line-216"></span><span>            </span><span class="hs-keyword">let</span><span> </span><span class="hs-identifier">vmin</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">c_cc</span><span> </span><span class="hs-special">`</span><span class="hs-identifier">plusPtr</span><span class="hs-special">`</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">fromIntegral</span><span> </span><span class="hs-identifier">const_vmin</span><span class="hs-special">)</span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">Word8</span><span>
</span><span id="line-217"></span><span>                </span><span class="hs-identifier">vtime</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">c_cc</span><span> </span><span class="hs-special">`</span><span class="hs-identifier">plusPtr</span><span class="hs-special">`</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">fromIntegral</span><span> </span><span class="hs-identifier">const_vtime</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">Word8</span><span>
</span><span id="line-218"></span><span>            </span><span class="hs-identifier">poke</span><span> </span><span class="hs-identifier">vmin</span><span>  </span><span class="hs-number">1</span><span>
</span><span id="line-219"></span><span>            </span><span class="hs-identifier">poke</span><span> </span><span class="hs-identifier">vtime</span><span> </span><span class="hs-number">0</span><span>
</span><span id="line-220"></span><span>
</span><span id="line-221"></span><span class="hs-identifier">tcSetAttr</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">CTermios</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">a</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">a</span><span>
</span><span id="line-222"></span><span class="hs-identifier">tcSetAttr</span><span> </span><span class="hs-identifier">fd</span><span> </span><span class="hs-identifier">fun</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-223"></span><span>     </span><span class="hs-identifier">allocaBytes</span><span> </span><span class="hs-identifier">sizeof_termios</span><span>  </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span class="hs-identifier">p_tios</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-224"></span><span>        </span><span class="hs-identifier">throwErrnoIfMinus1Retry_</span><span> </span><span class="hs-string">&quot;tcSetAttr&quot;</span><span>
</span><span id="line-225"></span><span>           </span><span class="hs-special">(</span><span class="hs-identifier">c_tcgetattr</span><span> </span><span class="hs-identifier">fd</span><span> </span><span class="hs-identifier">p_tios</span><span class="hs-special">)</span><span>
</span><span id="line-226"></span><span>
</span><span id="line-227"></span><span>        </span><span class="hs-comment">-- Save a copy of termios, if this is a standard file descriptor.</span><span>
</span><span id="line-228"></span><span>        </span><span class="hs-comment">-- These terminal settings are restored in hs_exit().</span><span>
</span><span id="line-229"></span><span>        </span><span class="hs-identifier">when</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">fd</span><span> </span><span class="hs-operator">&lt;=</span><span> </span><span class="hs-number">2</span><span class="hs-special">)</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-230"></span><span>          </span><span class="hs-identifier">p</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">get_saved_termios</span><span> </span><span class="hs-identifier">fd</span><span>
</span><span id="line-231"></span><span>          </span><span class="hs-identifier">when</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">p</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">nullPtr</span><span class="hs-special">)</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-232"></span><span>             </span><span class="hs-identifier">saved_tios</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">mallocBytes</span><span> </span><span class="hs-identifier">sizeof_termios</span><span>
</span><span id="line-233"></span><span>             </span><span class="hs-identifier">copyBytes</span><span> </span><span class="hs-identifier">saved_tios</span><span> </span><span class="hs-identifier">p_tios</span><span> </span><span class="hs-identifier">sizeof_termios</span><span>
</span><span id="line-234"></span><span>             </span><span class="hs-identifier">set_saved_termios</span><span> </span><span class="hs-identifier">fd</span><span> </span><span class="hs-identifier">saved_tios</span><span>
</span><span id="line-235"></span><span>
</span><span id="line-236"></span><span>        </span><span class="hs-comment">-- tcsetattr() when invoked by a background process causes the process</span><span>
</span><span id="line-237"></span><span>        </span><span class="hs-comment">-- to be sent SIGTTOU regardless of whether the process has TOSTOP set</span><span>
</span><span id="line-238"></span><span>        </span><span class="hs-comment">-- in its terminal flags (try it...).  This function provides a</span><span>
</span><span id="line-239"></span><span>        </span><span class="hs-comment">-- wrapper which temporarily blocks SIGTTOU around the call, making it</span><span>
</span><span id="line-240"></span><span>        </span><span class="hs-comment">-- transparent.</span><span>
</span><span id="line-241"></span><span>        </span><span class="hs-identifier">allocaBytes</span><span> </span><span class="hs-identifier">sizeof_sigset_t</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_sigset</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-242"></span><span>          </span><span class="hs-identifier">allocaBytes</span><span> </span><span class="hs-identifier">sizeof_sigset_t</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_old_sigset</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-243"></span><span>             </span><span class="hs-identifier">throwErrnoIfMinus1_</span><span> </span><span class="hs-string">&quot;sigemptyset&quot;</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-244"></span><span>                 </span><span class="hs-identifier">c_sigemptyset</span><span> </span><span class="hs-identifier">p_sigset</span><span>
</span><span id="line-245"></span><span>             </span><span class="hs-identifier">throwErrnoIfMinus1_</span><span> </span><span class="hs-string">&quot;sigaddset&quot;</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-246"></span><span>                 </span><span class="hs-identifier">c_sigaddset</span><span>   </span><span class="hs-identifier">p_sigset</span><span> </span><span class="hs-identifier">const_sigttou</span><span>
</span><span id="line-247"></span><span>             </span><span class="hs-identifier">throwErrnoIfMinus1_</span><span> </span><span class="hs-string">&quot;sigprocmask&quot;</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-248"></span><span>                 </span><span class="hs-identifier">c_sigprocmask</span><span> </span><span class="hs-identifier">const_sig_block</span><span> </span><span class="hs-identifier">p_sigset</span><span> </span><span class="hs-identifier">p_old_sigset</span><span>
</span><span id="line-249"></span><span>             </span><span class="hs-identifier">r</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">fun</span><span> </span><span class="hs-identifier">p_tios</span><span>  </span><span class="hs-comment">-- do the business</span><span>
</span><span id="line-250"></span><span>             </span><span class="hs-identifier">throwErrnoIfMinus1Retry_</span><span> </span><span class="hs-string">&quot;tcSetAttr&quot;</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-251"></span><span>                 </span><span class="hs-identifier">c_tcsetattr</span><span> </span><span class="hs-identifier">fd</span><span> </span><span class="hs-identifier">const_tcsanow</span><span> </span><span class="hs-identifier">p_tios</span><span>
</span><span id="line-252"></span><span>             </span><span class="hs-identifier">throwErrnoIfMinus1_</span><span> </span><span class="hs-string">&quot;sigprocmask&quot;</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-253"></span><span>                 </span><span class="hs-identifier">c_sigprocmask</span><span> </span><span class="hs-identifier">const_sig_setmask</span><span> </span><span class="hs-identifier">p_old_sigset</span><span> </span><span class="hs-identifier">nullPtr</span><span>
</span><span id="line-254"></span><span>             </span><span class="hs-identifier">return</span><span> </span><span class="hs-identifier">r</span><span>
</span><span id="line-255"></span><span>
</span><span id="line-256"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">ccall</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;HsBase.h __hscore_get_saved_termios&quot;</span><span>
</span><span id="line-257"></span><span>   </span><span class="hs-identifier">get_saved_termios</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">CInt</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">CTermios</span><span class="hs-special">)</span><span>
</span><span id="line-258"></span><span>
</span><span id="line-259"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">ccall</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;HsBase.h __hscore_set_saved_termios&quot;</span><span>
</span><span id="line-260"></span><span>   </span><span class="hs-identifier">set_saved_termios</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">CInt</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">CTermios</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-cpp">

#else
</span><span>
</span><span id="line-264"></span><span class="hs-comment">-- 'raw' mode for Win32 means turn off 'line input' (=&gt; buffering and</span><span>
</span><span id="line-265"></span><span class="hs-comment">-- character translation for the console.) The Win32 API for doing</span><span>
</span><span id="line-266"></span><span class="hs-comment">-- this is GetConsoleMode(), which also requires echoing to be disabled</span><span>
</span><span id="line-267"></span><span class="hs-comment">-- when turning off 'line input' processing. Notice that turning off</span><span>
</span><span id="line-268"></span><span class="hs-comment">-- 'line input' implies enter/return is reported as '\r' (and it won't</span><span>
</span><span id="line-269"></span><span class="hs-comment">-- report that character until another character is input..odd.) This</span><span>
</span><span id="line-270"></span><span class="hs-comment">-- latter feature doesn't sit too well with IO actions like IO.hGetLine..</span><span>
</span><span id="line-271"></span><span class="hs-comment">-- consider yourself warned.</span><span>
</span><span id="line-272"></span><span class="annot"><a href="System.Posix.Internals.html#setCooked"><span class="hs-identifier hs-type">setCooked</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="System.Posix.Internals.html#FD"><span class="hs-identifier hs-type">FD</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-273"></span><span id="setCooked"><span class="annot"><span class="annottext">setCooked :: CInt -&gt; Bool -&gt; IO ()
</span><a href="System.Posix.Internals.html#setCooked"><span class="hs-identifier hs-var hs-var">setCooked</span></a></span></span><span> </span><span id="local-6989586621679547375"><span class="annot"><span class="annottext">CInt
</span><a href="#local-6989586621679547375"><span class="hs-identifier hs-var">fd</span></a></span></span><span> </span><span id="local-6989586621679547374"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679547374"><span class="hs-identifier hs-var">cooked</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-274"></span><span>  </span><span id="local-6989586621679547373"><span class="annot"><span class="annottext">CInt
</span><a href="#local-6989586621679547373"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CInt -&gt; CInt -&gt; IO CInt
</span><a href="System.Posix.Internals.html#set_console_buffering"><span class="hs-identifier hs-var">set_console_buffering</span></a></span><span> </span><span class="annot"><span class="annottext">CInt
</span><a href="#local-6989586621679547375"><span class="hs-identifier hs-var">fd</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679547374"><span class="hs-identifier hs-var">cooked</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">CInt
</span><span class="hs-number">1</span></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">CInt
</span><span class="hs-number">0</span></span><span class="hs-special">)</span><span>
</span><span id="line-275"></span><span>  </span><span class="hs-keyword">if</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CInt
</span><a href="#local-6989586621679547373"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">CInt -&gt; CInt -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%2F%3D"><span class="hs-operator hs-var">/=</span></a></span><span> </span><span class="annot"><span class="annottext">CInt
</span><span class="hs-number">0</span></span><span class="hs-special">)</span><span>
</span><span id="line-276"></span><span>   </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">IOError -&gt; IO ()
forall a. IOError -&gt; IO a
</span><a href="GHC.IO.Exception.html#ioError"><span class="hs-identifier hs-var">ioError</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; String -&gt; IOError
</span><a href="System.Posix.Internals.html#ioe_unk_error"><span class="hs-identifier hs-var">ioe_unk_error</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;setCooked&quot;</span></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;failed to set buffering&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-277"></span><span>   </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">() -&gt; IO ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-278"></span><span>
</span><span id="line-279"></span><span class="annot"><a href="System.Posix.Internals.html#ioe_unk_error"><span class="hs-identifier hs-type">ioe_unk_error</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.IO.Exception.html#IOException"><span class="hs-identifier hs-type">IOException</span></a></span><span>
</span><span id="line-280"></span><span id="ioe_unk_error"><span class="annot"><span class="annottext">ioe_unk_error :: String -&gt; String -&gt; IOError
</span><a href="System.Posix.Internals.html#ioe_unk_error"><span class="hs-identifier hs-var hs-var">ioe_unk_error</span></a></span></span><span> </span><span id="local-6989586621679547370"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679547370"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span id="local-6989586621679547369"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679547369"><span class="hs-identifier hs-var">msg</span></a></span></span><span>
</span><span id="line-281"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IOError -&gt; String -&gt; IOError
</span><a href="System.IO.Error.html#ioeSetErrorString"><span class="hs-identifier hs-var">ioeSetErrorString</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IOErrorType -&gt; String -&gt; Maybe Handle -&gt; Maybe String -&gt; IOError
</span><a href="System.IO.Error.html#mkIOError"><span class="hs-identifier hs-var">mkIOError</span></a></span><span> </span><span class="annot"><span class="annottext">IOErrorType
</span><a href="GHC.IO.Exception.html#OtherError"><span class="hs-identifier hs-var">OtherError</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679547370"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Handle
forall a. Maybe a
</span><a href="GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe String
forall a. Maybe a
</span><a href="GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679547369"><span class="hs-identifier hs-var">msg</span></a></span><span>
</span><span id="line-282"></span><span>
</span><span id="line-283"></span><span class="hs-comment">-- Note: echoing goes hand in hand with enabling 'line input' / raw-ness</span><span>
</span><span id="line-284"></span><span class="hs-comment">-- for Win32 consoles, hence setEcho ends up being the inverse of setCooked.</span><span>
</span><span id="line-285"></span><span class="annot"><a href="System.Posix.Internals.html#setEcho"><span class="hs-identifier hs-type">setEcho</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="System.Posix.Internals.html#FD"><span class="hs-identifier hs-type">FD</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-286"></span><span id="setEcho"><span class="annot"><span class="annottext">setEcho :: CInt -&gt; Bool -&gt; IO ()
</span><a href="System.Posix.Internals.html#setEcho"><span class="hs-identifier hs-var hs-var">setEcho</span></a></span></span><span> </span><span id="local-6989586621679547364"><span class="annot"><span class="annottext">CInt
</span><a href="#local-6989586621679547364"><span class="hs-identifier hs-var">fd</span></a></span></span><span> </span><span id="local-6989586621679547363"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679547363"><span class="hs-identifier hs-var">on</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-287"></span><span>  </span><span id="local-6989586621679547362"><span class="annot"><span class="annottext">CInt
</span><a href="#local-6989586621679547362"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CInt -&gt; CInt -&gt; IO CInt
</span><a href="System.Posix.Internals.html#set_console_echo"><span class="hs-identifier hs-var">set_console_echo</span></a></span><span> </span><span class="annot"><span class="annottext">CInt
</span><a href="#local-6989586621679547364"><span class="hs-identifier hs-var">fd</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679547363"><span class="hs-identifier hs-var">on</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">CInt
</span><span class="hs-number">1</span></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">CInt
</span><span class="hs-number">0</span></span><span class="hs-special">)</span><span>
</span><span id="line-288"></span><span>  </span><span class="hs-keyword">if</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CInt
</span><a href="#local-6989586621679547362"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">CInt -&gt; CInt -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%2F%3D"><span class="hs-operator hs-var">/=</span></a></span><span> </span><span class="annot"><span class="annottext">CInt
</span><span class="hs-number">0</span></span><span class="hs-special">)</span><span>
</span><span id="line-289"></span><span>   </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">IOError -&gt; IO ()
forall a. IOError -&gt; IO a
</span><a href="GHC.IO.Exception.html#ioError"><span class="hs-identifier hs-var">ioError</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; String -&gt; IOError
</span><a href="System.Posix.Internals.html#ioe_unk_error"><span class="hs-identifier hs-var">ioe_unk_error</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;setEcho&quot;</span></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;failed to set echoing&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-290"></span><span>   </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">() -&gt; IO ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-291"></span><span>
</span><span id="line-292"></span><span class="annot"><a href="System.Posix.Internals.html#getEcho"><span class="hs-identifier hs-type">getEcho</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="System.Posix.Internals.html#FD"><span class="hs-identifier hs-type">FD</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span>
</span><span id="line-293"></span><span id="getEcho"><span class="annot"><span class="annottext">getEcho :: CInt -&gt; IO Bool
</span><a href="System.Posix.Internals.html#getEcho"><span class="hs-identifier hs-var hs-var">getEcho</span></a></span></span><span> </span><span id="local-6989586621679547359"><span class="annot"><span class="annottext">CInt
</span><a href="#local-6989586621679547359"><span class="hs-identifier hs-var">fd</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-294"></span><span>  </span><span id="local-6989586621679547358"><span class="annot"><span class="annottext">CInt
</span><a href="#local-6989586621679547358"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CInt -&gt; IO CInt
</span><a href="System.Posix.Internals.html#get_console_echo"><span class="hs-identifier hs-var">get_console_echo</span></a></span><span> </span><span class="annot"><span class="annottext">CInt
</span><a href="#local-6989586621679547359"><span class="hs-identifier hs-var">fd</span></a></span><span>
</span><span id="line-295"></span><span>  </span><span class="hs-keyword">if</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CInt
</span><a href="#local-6989586621679547358"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">CInt -&gt; CInt -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">-</span><span class="annot"><span class="annottext">CInt
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-296"></span><span>   </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">IOError -&gt; IO Bool
forall a. IOError -&gt; IO a
</span><a href="GHC.IO.Exception.html#ioError"><span class="hs-identifier hs-var">ioError</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; String -&gt; IOError
</span><a href="System.Posix.Internals.html#ioe_unk_error"><span class="hs-identifier hs-var">ioe_unk_error</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;getEcho&quot;</span></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;failed to get echoing&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-297"></span><span>   </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; IO Bool
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CInt
</span><a href="#local-6989586621679547358"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">CInt -&gt; CInt -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">CInt
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>
</span><span id="line-298"></span><span>
</span><span id="line-299"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;consUtils.h set_console_buffering__&quot;</span></span><span>
</span><span id="line-300"></span><span>   </span><span id="set_console_buffering"><span class="annot"><a href="System.Posix.Internals.html#set_console_buffering"><span class="hs-identifier hs-var">set_console_buffering</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-301"></span><span>
</span><span id="line-302"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;consUtils.h set_console_echo__&quot;</span></span><span>
</span><span id="line-303"></span><span>   </span><span id="set_console_echo"><span class="annot"><a href="System.Posix.Internals.html#set_console_echo"><span class="hs-identifier hs-var">set_console_echo</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-304"></span><span>
</span><span id="line-305"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;consUtils.h get_console_echo__&quot;</span></span><span>
</span><span id="line-306"></span><span>   </span><span id="get_console_echo"><span class="annot"><a href="System.Posix.Internals.html#get_console_echo"><span class="hs-identifier hs-var">get_console_echo</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-307"></span><span>
</span><span id="line-308"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;consUtils.h is_console__&quot;</span></span><span>
</span><span id="line-309"></span><span>   </span><span id="is_console"><span class="annot"><a href="System.Posix.Internals.html#is_console"><span class="hs-identifier hs-var">is_console</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span class="hs-cpp">

#endif
</span><span>
</span><span id="line-313"></span><span class="hs-comment">-- ---------------------------------------------------------------------------</span><span>
</span><span id="line-314"></span><span class="hs-comment">-- Turning on non-blocking for a file descriptor</span><span>
</span><span id="line-315"></span><span>
</span><span id="line-316"></span><span class="annot"><a href="System.Posix.Internals.html#setNonBlockingFD"><span class="hs-identifier hs-type">setNonBlockingFD</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="System.Posix.Internals.html#FD"><span class="hs-identifier hs-type">FD</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-cpp">
#if !defined(mingw32_HOST_OS)
</span><span class="hs-identifier">setNonBlockingFD</span><span> </span><span class="hs-identifier">fd</span><span> </span><span class="hs-identifier">set</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-319"></span><span>  </span><span class="hs-identifier">flags</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">throwErrnoIfMinus1Retry</span><span> </span><span class="hs-string">&quot;setNonBlockingFD&quot;</span><span>
</span><span id="line-320"></span><span>                 </span><span class="hs-special">(</span><span class="hs-identifier">c_fcntl_read</span><span> </span><span class="hs-identifier">fd</span><span> </span><span class="hs-identifier">const_f_getfl</span><span class="hs-special">)</span><span>
</span><span id="line-321"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span class="hs-identifier">flags'</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="hs-identifier">set</span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">flags</span><span> </span><span class="hs-operator">.|.</span><span> </span><span class="hs-identifier">o_NONBLOCK</span><span>
</span><span id="line-322"></span><span>             </span><span class="hs-glyph">|</span><span> </span><span class="hs-identifier">otherwise</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">flags</span><span> </span><span class="hs-operator">.&amp;.</span><span> </span><span class="hs-identifier">complement</span><span> </span><span class="hs-identifier">o_NONBLOCK</span><span>
</span><span id="line-323"></span><span>  </span><span class="hs-identifier">when</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">flags</span><span> </span><span class="hs-operator">/=</span><span> </span><span class="hs-identifier">flags'</span><span class="hs-special">)</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-324"></span><span>    </span><span class="hs-comment">-- An error when setting O_NONBLOCK isn't fatal: on some systems</span><span>
</span><span id="line-325"></span><span>    </span><span class="hs-comment">-- there are certain file handles on which this will fail (eg. /dev/null</span><span>
</span><span id="line-326"></span><span>    </span><span class="hs-comment">-- on FreeBSD) so we throw away the return code from fcntl_write.</span><span>
</span><span id="line-327"></span><span>    </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">c_fcntl_write</span><span> </span><span class="hs-identifier">fd</span><span> </span><span class="hs-identifier">const_f_setfl</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">fromIntegral</span><span> </span><span class="hs-identifier">flags'</span><span class="hs-special">)</span><span>
</span><span id="line-328"></span><span>    </span><span class="hs-identifier">return</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-cpp">
#else
</span><span>
</span><span id="line-331"></span><span class="hs-comment">-- bogus defns for win32</span><span>
</span><span id="line-332"></span><span id="setNonBlockingFD"><span class="annot"><span class="annottext">setNonBlockingFD :: CInt -&gt; Bool -&gt; IO ()
</span><a href="System.Posix.Internals.html#setNonBlockingFD"><span class="hs-identifier hs-var hs-var">setNonBlockingFD</span></a></span></span><span> </span><span class="annot"><span class="annottext">CInt
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; IO ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-cpp">

#endif
</span><span>
</span><span id="line-336"></span><span class="hs-comment">-- -----------------------------------------------------------------------------</span><span>
</span><span id="line-337"></span><span class="hs-comment">-- Set close-on-exec for a file descriptor</span><span class="hs-cpp">

#if !defined(mingw32_HOST_OS)
</span><span class="hs-identifier">setCloseOnExec</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-341"></span><span class="hs-identifier">setCloseOnExec</span><span> </span><span class="hs-identifier">fd</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-342"></span><span>  </span><span class="hs-identifier">throwErrnoIfMinus1_</span><span> </span><span class="hs-string">&quot;setCloseOnExec&quot;</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-343"></span><span>    </span><span class="hs-identifier">c_fcntl_write</span><span> </span><span class="hs-identifier">fd</span><span> </span><span class="hs-identifier">const_f_setfd</span><span> </span><span class="hs-identifier">const_fd_cloexec</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-346"></span><span class="hs-comment">-- -----------------------------------------------------------------------------</span><span>
</span><span id="line-347"></span><span class="hs-comment">-- foreign imports</span><span class="hs-cpp">

#if !defined(mingw32_HOST_OS)
</span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">CFilePath</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">CString</span><span class="hs-cpp">
#else
</span><span class="hs-keyword">type</span><span> </span><span id="CFilePath"><span class="annot"><a href="System.Posix.Internals.html#CFilePath"><span class="hs-identifier hs-var">CFilePath</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="Foreign.C.String.html#CWString"><span class="hs-identifier hs-type">CWString</span></a></span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-355"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h __hscore_open&quot;</span></span><span>
</span><span id="line-356"></span><span>   </span><span id="c_open"><span class="annot"><a href="System.Posix.Internals.html#c_open"><span class="hs-identifier hs-var">c_open</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="System.Posix.Internals.html#CFilePath"><span class="hs-identifier hs-type">CFilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="System.Posix.Types.html#CMode"><span class="hs-identifier hs-type">CMode</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-357"></span><span>
</span><span id="line-358"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">safe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h __hscore_open&quot;</span></span><span>
</span><span id="line-359"></span><span>   </span><span id="c_safe_open"><span class="annot"><a href="System.Posix.Internals.html#c_safe_open"><span class="hs-identifier hs-var">c_safe_open</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="System.Posix.Internals.html#CFilePath"><span class="hs-identifier hs-type">CFilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="System.Posix.Types.html#CMode"><span class="hs-identifier hs-type">CMode</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-360"></span><span>
</span><span id="line-361"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h __hscore_fstat&quot;</span></span><span>
</span><span id="line-362"></span><span>   </span><span id="c_fstat"><span class="annot"><a href="System.Posix.Internals.html#c_fstat"><span class="hs-identifier hs-var">c_fstat</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="System.Posix.Internals.html#CStat"><span class="hs-identifier hs-type">CStat</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-363"></span><span>
</span><span id="line-364"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h __hscore_lstat&quot;</span></span><span>
</span><span id="line-365"></span><span>   </span><span id="lstat"><span class="annot"><a href="System.Posix.Internals.html#lstat"><span class="hs-identifier hs-var">lstat</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="System.Posix.Internals.html#CFilePath"><span class="hs-identifier hs-type">CFilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="System.Posix.Internals.html#CStat"><span class="hs-identifier hs-type">CStat</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-366"></span><span>
</span><span id="line-367"></span><span class="hs-comment">{- Note: Win32 POSIX functions
Functions that are not part of the POSIX standards were
at some point deprecated by Microsoft. This deprecation
was performed by renaming the functions according to the
C++ ABI Section 17.6.4.3.2b. This was done to free up the
namespace of normal Windows programs since Windows isn't
POSIX compliant anyway.

These were working before since the RTS was re-exporting
these symbols under the undeprecated names. This is no longer
being done. See #11223

See https://msdn.microsoft.com/en-us/library/ms235384.aspx
for more.

However since we can't hope to get people to support Windows
packages we should support the deprecated names. See #12497
-}</span><span>
</span><span id="line-385"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">capi</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;unistd.h lseek&quot;</span></span><span>
</span><span id="line-386"></span><span>   </span><span id="c_lseek"><span class="annot"><a href="System.Posix.Internals.html#c_lseek"><span class="hs-identifier hs-var">c_lseek</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="System.Posix.Types.html#COff"><span class="hs-identifier hs-type">COff</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="System.Posix.Types.html#COff"><span class="hs-identifier hs-type">COff</span></a></span><span>
</span><span id="line-387"></span><span>
</span><span id="line-388"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h access&quot;</span></span><span>
</span><span id="line-389"></span><span>   </span><span id="c_access"><span class="annot"><a href="System.Posix.Internals.html#c_access"><span class="hs-identifier hs-var">c_access</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.String.html#CString"><span class="hs-identifier hs-type">CString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-390"></span><span>
</span><span id="line-391"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h chmod&quot;</span></span><span>
</span><span id="line-392"></span><span>   </span><span id="c_chmod"><span class="annot"><a href="System.Posix.Internals.html#c_chmod"><span class="hs-identifier hs-var">c_chmod</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.String.html#CString"><span class="hs-identifier hs-type">CString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="System.Posix.Types.html#CMode"><span class="hs-identifier hs-type">CMode</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-393"></span><span>
</span><span id="line-394"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h close&quot;</span></span><span>
</span><span id="line-395"></span><span>   </span><span id="c_close"><span class="annot"><a href="System.Posix.Internals.html#c_close"><span class="hs-identifier hs-var">c_close</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-396"></span><span>
</span><span id="line-397"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h creat&quot;</span></span><span>
</span><span id="line-398"></span><span>   </span><span id="c_creat"><span class="annot"><a href="System.Posix.Internals.html#c_creat"><span class="hs-identifier hs-var">c_creat</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.String.html#CString"><span class="hs-identifier hs-type">CString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="System.Posix.Types.html#CMode"><span class="hs-identifier hs-type">CMode</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-399"></span><span>
</span><span id="line-400"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h dup&quot;</span></span><span>
</span><span id="line-401"></span><span>   </span><span id="c_dup"><span class="annot"><a href="System.Posix.Internals.html#c_dup"><span class="hs-identifier hs-var">c_dup</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-402"></span><span>
</span><span id="line-403"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h dup2&quot;</span></span><span>
</span><span id="line-404"></span><span>   </span><span id="c_dup2"><span class="annot"><a href="System.Posix.Internals.html#c_dup2"><span class="hs-identifier hs-var">c_dup2</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-405"></span><span>
</span><span id="line-406"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h isatty&quot;</span></span><span>
</span><span id="line-407"></span><span>   </span><span id="c_isatty"><span class="annot"><a href="System.Posix.Internals.html#c_isatty"><span class="hs-identifier hs-var">c_isatty</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span class="hs-cpp">

#if defined(mingw32_HOST_OS)
</span><span class="hs-comment">-- See Note: Windows types</span><span>
</span><span id="line-411"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">capi</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h _read&quot;</span></span><span>
</span><span id="line-412"></span><span>   </span><span id="c_read"><span class="annot"><a href="System.Posix.Internals.html#c_read"><span class="hs-identifier hs-var">c_read</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CUInt"><span class="hs-identifier hs-type">CUInt</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-413"></span><span>
</span><span id="line-414"></span><span class="hs-comment">-- See Note: Windows types</span><span>
</span><span id="line-415"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">capi</span></span><span> </span><span class="annot"><span class="hs-keyword">safe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h _read&quot;</span></span><span>
</span><span id="line-416"></span><span>   </span><span id="c_safe_read"><span class="annot"><a href="System.Posix.Internals.html#c_safe_read"><span class="hs-identifier hs-var">c_safe_read</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CUInt"><span class="hs-identifier hs-type">CUInt</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-417"></span><span>
</span><span id="line-418"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h _umask&quot;</span></span><span>
</span><span id="line-419"></span><span>   </span><span id="c_umask"><span class="annot"><a href="System.Posix.Internals.html#c_umask"><span class="hs-identifier hs-var">c_umask</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="System.Posix.Types.html#CMode"><span class="hs-identifier hs-type">CMode</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="System.Posix.Types.html#CMode"><span class="hs-identifier hs-type">CMode</span></a></span><span>
</span><span id="line-420"></span><span>
</span><span id="line-421"></span><span class="hs-comment">-- See Note: Windows types</span><span>
</span><span id="line-422"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">capi</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h _write&quot;</span></span><span>
</span><span id="line-423"></span><span>   </span><span id="c_write"><span class="annot"><a href="System.Posix.Internals.html#c_write"><span class="hs-identifier hs-var">c_write</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CUInt"><span class="hs-identifier hs-type">CUInt</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-424"></span><span>
</span><span id="line-425"></span><span class="hs-comment">-- See Note: Windows types</span><span>
</span><span id="line-426"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">capi</span></span><span> </span><span class="annot"><span class="hs-keyword">safe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h _write&quot;</span></span><span>
</span><span id="line-427"></span><span>   </span><span id="c_safe_write"><span class="annot"><a href="System.Posix.Internals.html#c_safe_write"><span class="hs-identifier hs-var">c_safe_write</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CUInt"><span class="hs-identifier hs-type">CUInt</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-428"></span><span>
</span><span id="line-429"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h _pipe&quot;</span></span><span>
</span><span id="line-430"></span><span>   </span><span id="c_pipe"><span class="annot"><a href="System.Posix.Internals.html#c_pipe"><span class="hs-identifier hs-var">c_pipe</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span class="hs-cpp">
#else
</span><span class="hs-comment">-- We use CAPI as on some OSs (eg. Linux) this is wrapped by a macro</span><span>
</span><span id="line-433"></span><span class="hs-comment">-- which redirects to the 64-bit-off_t versions when large file</span><span>
</span><span id="line-434"></span><span class="hs-comment">-- support is enabled.</span><span>
</span><span id="line-435"></span><span>
</span><span id="line-436"></span><span class="hs-comment">-- See Note: Windows types</span><span>
</span><span id="line-437"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">capi</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;HsBase.h read&quot;</span><span>
</span><span id="line-438"></span><span>   </span><span class="hs-identifier">c_read</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">CInt</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">Word8</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">CSize</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">CSsize</span><span>
</span><span id="line-439"></span><span>
</span><span id="line-440"></span><span class="hs-comment">-- See Note: Windows types</span><span>
</span><span id="line-441"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">capi</span><span> </span><span class="hs-keyword">safe</span><span> </span><span class="hs-string">&quot;HsBase.h read&quot;</span><span>
</span><span id="line-442"></span><span>   </span><span class="hs-identifier">c_safe_read</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">CInt</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">Word8</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">CSize</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">CSsize</span><span>
</span><span id="line-443"></span><span>
</span><span id="line-444"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">ccall</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;HsBase.h umask&quot;</span><span>
</span><span id="line-445"></span><span>   </span><span class="hs-identifier">c_umask</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">CMode</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">CMode</span><span>
</span><span id="line-446"></span><span>
</span><span id="line-447"></span><span class="hs-comment">-- See Note: Windows types</span><span>
</span><span id="line-448"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">capi</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;HsBase.h write&quot;</span><span>
</span><span id="line-449"></span><span>   </span><span class="hs-identifier">c_write</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">CInt</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">Word8</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">CSize</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">CSsize</span><span>
</span><span id="line-450"></span><span>
</span><span id="line-451"></span><span class="hs-comment">-- See Note: Windows types</span><span>
</span><span id="line-452"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">capi</span><span> </span><span class="hs-keyword">safe</span><span> </span><span class="hs-string">&quot;HsBase.h write&quot;</span><span>
</span><span id="line-453"></span><span>   </span><span class="hs-identifier">c_safe_write</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">CInt</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">Word8</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">CSize</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">CSsize</span><span>
</span><span id="line-454"></span><span>
</span><span id="line-455"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">ccall</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;HsBase.h pipe&quot;</span><span>
</span><span id="line-456"></span><span>   </span><span class="hs-identifier">c_pipe</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">CInt</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">CInt</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-459"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h unlink&quot;</span></span><span>
</span><span id="line-460"></span><span>   </span><span id="c_unlink"><span class="annot"><a href="System.Posix.Internals.html#c_unlink"><span class="hs-identifier hs-var">c_unlink</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.String.html#CString"><span class="hs-identifier hs-type">CString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-461"></span><span>
</span><span id="line-462"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">capi</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h utime&quot;</span></span><span>
</span><span id="line-463"></span><span>   </span><span id="c_utime"><span class="annot"><a href="System.Posix.Internals.html#c_utime"><span class="hs-identifier hs-var">c_utime</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.String.html#CString"><span class="hs-identifier hs-type">CString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="System.Posix.Internals.html#CUtimbuf"><span class="hs-identifier hs-type">CUtimbuf</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-464"></span><span>
</span><span id="line-465"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h getpid&quot;</span></span><span>
</span><span id="line-466"></span><span>   </span><span id="c_getpid"><span class="annot"><a href="System.Posix.Internals.html#c_getpid"><span class="hs-identifier hs-var">c_getpid</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="System.Posix.Types.html#CPid"><span class="hs-identifier hs-type">CPid</span></a></span><span>
</span><span id="line-467"></span><span>
</span><span id="line-468"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h __hscore_stat&quot;</span></span><span>
</span><span id="line-469"></span><span>   </span><span id="c_stat"><span class="annot"><a href="System.Posix.Internals.html#c_stat"><span class="hs-identifier hs-var">c_stat</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="System.Posix.Internals.html#CFilePath"><span class="hs-identifier hs-type">CFilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="System.Posix.Internals.html#CStat"><span class="hs-identifier hs-type">CStat</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-470"></span><span>
</span><span id="line-471"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h __hscore_ftruncate&quot;</span></span><span>
</span><span id="line-472"></span><span>   </span><span id="c_ftruncate"><span class="annot"><a href="System.Posix.Internals.html#c_ftruncate"><span class="hs-identifier hs-var">c_ftruncate</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="System.Posix.Types.html#COff"><span class="hs-identifier hs-type">COff</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span class="hs-cpp">

#if !defined(mingw32_HOST_OS)
</span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">capi</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;HsBase.h fcntl&quot;</span><span>
</span><span id="line-476"></span><span>   </span><span class="hs-identifier">c_fcntl_read</span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">CInt</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">CInt</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">CInt</span><span>
</span><span id="line-477"></span><span>
</span><span id="line-478"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">capi</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;HsBase.h fcntl&quot;</span><span>
</span><span id="line-479"></span><span>   </span><span class="hs-identifier">c_fcntl_write</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">CInt</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">CInt</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">CLong</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">CInt</span><span>
</span><span id="line-480"></span><span>
</span><span id="line-481"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">capi</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;HsBase.h fcntl&quot;</span><span>
</span><span id="line-482"></span><span>   </span><span class="hs-identifier">c_fcntl_lock</span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">CInt</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">CInt</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">CFLock</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">CInt</span><span>
</span><span id="line-483"></span><span>
</span><span id="line-484"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">ccall</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;HsBase.h fork&quot;</span><span>
</span><span id="line-485"></span><span>   </span><span class="hs-identifier">c_fork</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">CPid</span><span>
</span><span id="line-486"></span><span>
</span><span id="line-487"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">ccall</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;HsBase.h link&quot;</span><span>
</span><span id="line-488"></span><span>   </span><span class="hs-identifier">c_link</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">CString</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">CString</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">CInt</span><span>
</span><span id="line-489"></span><span>
</span><span id="line-490"></span><span class="hs-comment">-- capi is required at least on Android</span><span>
</span><span id="line-491"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">capi</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;HsBase.h mkfifo&quot;</span><span>
</span><span id="line-492"></span><span>   </span><span class="hs-identifier">c_mkfifo</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">CString</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">CMode</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">CInt</span><span>
</span><span id="line-493"></span><span>
</span><span id="line-494"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">capi</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;signal.h sigemptyset&quot;</span><span>
</span><span id="line-495"></span><span>   </span><span class="hs-identifier">c_sigemptyset</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">CSigset</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">CInt</span><span>
</span><span id="line-496"></span><span>
</span><span id="line-497"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">capi</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;signal.h sigaddset&quot;</span><span>
</span><span id="line-498"></span><span>   </span><span class="hs-identifier">c_sigaddset</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">CSigset</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">CInt</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">CInt</span><span>
</span><span id="line-499"></span><span>
</span><span id="line-500"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">capi</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;signal.h sigprocmask&quot;</span><span>
</span><span id="line-501"></span><span>   </span><span class="hs-identifier">c_sigprocmask</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">CInt</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">CSigset</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">CSigset</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">CInt</span><span>
</span><span id="line-502"></span><span>
</span><span id="line-503"></span><span class="hs-comment">-- capi is required at least on Android</span><span>
</span><span id="line-504"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">capi</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;HsBase.h tcgetattr&quot;</span><span>
</span><span id="line-505"></span><span>   </span><span class="hs-identifier">c_tcgetattr</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">CInt</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">CTermios</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">CInt</span><span>
</span><span id="line-506"></span><span>
</span><span id="line-507"></span><span class="hs-comment">-- capi is required at least on Android</span><span>
</span><span id="line-508"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">capi</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;HsBase.h tcsetattr&quot;</span><span>
</span><span id="line-509"></span><span>   </span><span class="hs-identifier">c_tcsetattr</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">CInt</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">CInt</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">CTermios</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">CInt</span><span>
</span><span id="line-510"></span><span>
</span><span id="line-511"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">ccall</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;HsBase.h waitpid&quot;</span><span>
</span><span id="line-512"></span><span>   </span><span class="hs-identifier">c_waitpid</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">CPid</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">CInt</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">CInt</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">CPid</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-515"></span><span class="hs-comment">-- POSIX flags only:</span><span>
</span><span id="line-516"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h __hscore_o_rdonly&quot;</span></span><span> </span><span id="o_RDONLY"><span class="annot"><a href="System.Posix.Internals.html#o_RDONLY"><span class="hs-identifier hs-var">o_RDONLY</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-517"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h __hscore_o_wronly&quot;</span></span><span> </span><span id="o_WRONLY"><span class="annot"><a href="System.Posix.Internals.html#o_WRONLY"><span class="hs-identifier hs-var">o_WRONLY</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-518"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h __hscore_o_rdwr&quot;</span></span><span>   </span><span id="o_RDWR"><span class="annot"><a href="System.Posix.Internals.html#o_RDWR"><span class="hs-identifier hs-var">o_RDWR</span></a></span></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-519"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h __hscore_o_append&quot;</span></span><span> </span><span id="o_APPEND"><span class="annot"><a href="System.Posix.Internals.html#o_APPEND"><span class="hs-identifier hs-var">o_APPEND</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-520"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h __hscore_o_creat&quot;</span></span><span>  </span><span id="o_CREAT"><span class="annot"><a href="System.Posix.Internals.html#o_CREAT"><span class="hs-identifier hs-var">o_CREAT</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-521"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h __hscore_o_excl&quot;</span></span><span>   </span><span id="o_EXCL"><span class="annot"><a href="System.Posix.Internals.html#o_EXCL"><span class="hs-identifier hs-var">o_EXCL</span></a></span></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-522"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h __hscore_o_trunc&quot;</span></span><span>  </span><span id="o_TRUNC"><span class="annot"><a href="System.Posix.Internals.html#o_TRUNC"><span class="hs-identifier hs-var">o_TRUNC</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-523"></span><span>
</span><span id="line-524"></span><span class="hs-comment">-- non-POSIX flags.</span><span>
</span><span id="line-525"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h __hscore_o_noctty&quot;</span></span><span>   </span><span id="o_NOCTTY"><span class="annot"><a href="System.Posix.Internals.html#o_NOCTTY"><span class="hs-identifier hs-var">o_NOCTTY</span></a></span></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-526"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h __hscore_o_nonblock&quot;</span></span><span> </span><span id="o_NONBLOCK"><span class="annot"><a href="System.Posix.Internals.html#o_NONBLOCK"><span class="hs-identifier hs-var">o_NONBLOCK</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-527"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h __hscore_o_binary&quot;</span></span><span>   </span><span id="o_BINARY"><span class="annot"><a href="System.Posix.Internals.html#o_BINARY"><span class="hs-identifier hs-var">o_BINARY</span></a></span></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-528"></span><span>
</span><span id="line-529"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">capi</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;sys/stat.h S_ISREG&quot;</span></span><span>  </span><span id="c_s_isreg"><span class="annot"><a href="System.Posix.Internals.html#c_s_isreg"><span class="hs-identifier hs-var">c_s_isreg</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="System.Posix.Types.html#CMode"><span class="hs-identifier hs-type">CMode</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-530"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">capi</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;sys/stat.h S_ISCHR&quot;</span></span><span>  </span><span id="c_s_ischr"><span class="annot"><a href="System.Posix.Internals.html#c_s_ischr"><span class="hs-identifier hs-var">c_s_ischr</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="System.Posix.Types.html#CMode"><span class="hs-identifier hs-type">CMode</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-531"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">capi</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;sys/stat.h S_ISBLK&quot;</span></span><span>  </span><span id="c_s_isblk"><span class="annot"><a href="System.Posix.Internals.html#c_s_isblk"><span class="hs-identifier hs-var">c_s_isblk</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="System.Posix.Types.html#CMode"><span class="hs-identifier hs-type">CMode</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-532"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">capi</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;sys/stat.h S_ISDIR&quot;</span></span><span>  </span><span id="c_s_isdir"><span class="annot"><a href="System.Posix.Internals.html#c_s_isdir"><span class="hs-identifier hs-var">c_s_isdir</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="System.Posix.Types.html#CMode"><span class="hs-identifier hs-type">CMode</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-533"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">capi</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;sys/stat.h S_ISFIFO&quot;</span></span><span> </span><span id="c_s_isfifo"><span class="annot"><a href="System.Posix.Internals.html#c_s_isfifo"><span class="hs-identifier hs-var">c_s_isfifo</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="System.Posix.Types.html#CMode"><span class="hs-identifier hs-type">CMode</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-534"></span><span>
</span><span id="line-535"></span><span class="annot"><a href="System.Posix.Internals.html#s_isreg"><span class="hs-identifier hs-type">s_isreg</span></a></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="System.Posix.Types.html#CMode"><span class="hs-identifier hs-type">CMode</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span>
</span><span id="line-536"></span><span id="s_isreg"><span class="annot"><span class="annottext">s_isreg :: CMode -&gt; Bool
</span><a href="System.Posix.Internals.html#s_isreg"><span class="hs-identifier hs-var hs-var">s_isreg</span></a></span></span><span> </span><span id="local-6989586621679547318"><span class="annot"><span class="annottext">CMode
</span><a href="#local-6989586621679547318"><span class="hs-identifier hs-var">cm</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CMode -&gt; CInt
</span><a href="System.Posix.Internals.html#c_s_isreg"><span class="hs-identifier hs-var">c_s_isreg</span></a></span><span> </span><span class="annot"><span class="annottext">CMode
</span><a href="#local-6989586621679547318"><span class="hs-identifier hs-var">cm</span></a></span><span> </span><span class="annot"><span class="annottext">CInt -&gt; CInt -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%2F%3D"><span class="hs-operator hs-var">/=</span></a></span><span> </span><span class="annot"><span class="annottext">CInt
</span><span class="hs-number">0</span></span><span>
</span><span id="line-537"></span><span class="annot"><a href="System.Posix.Internals.html#s_ischr"><span class="hs-identifier hs-type">s_ischr</span></a></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="System.Posix.Types.html#CMode"><span class="hs-identifier hs-type">CMode</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span>
</span><span id="line-538"></span><span id="s_ischr"><span class="annot"><span class="annottext">s_ischr :: CMode -&gt; Bool
</span><a href="System.Posix.Internals.html#s_ischr"><span class="hs-identifier hs-var hs-var">s_ischr</span></a></span></span><span> </span><span id="local-6989586621679547317"><span class="annot"><span class="annottext">CMode
</span><a href="#local-6989586621679547317"><span class="hs-identifier hs-var">cm</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CMode -&gt; CInt
</span><a href="System.Posix.Internals.html#c_s_ischr"><span class="hs-identifier hs-var">c_s_ischr</span></a></span><span> </span><span class="annot"><span class="annottext">CMode
</span><a href="#local-6989586621679547317"><span class="hs-identifier hs-var">cm</span></a></span><span> </span><span class="annot"><span class="annottext">CInt -&gt; CInt -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%2F%3D"><span class="hs-operator hs-var">/=</span></a></span><span> </span><span class="annot"><span class="annottext">CInt
</span><span class="hs-number">0</span></span><span>
</span><span id="line-539"></span><span class="annot"><a href="System.Posix.Internals.html#s_isblk"><span class="hs-identifier hs-type">s_isblk</span></a></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="System.Posix.Types.html#CMode"><span class="hs-identifier hs-type">CMode</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span>
</span><span id="line-540"></span><span id="s_isblk"><span class="annot"><span class="annottext">s_isblk :: CMode -&gt; Bool
</span><a href="System.Posix.Internals.html#s_isblk"><span class="hs-identifier hs-var hs-var">s_isblk</span></a></span></span><span> </span><span id="local-6989586621679547316"><span class="annot"><span class="annottext">CMode
</span><a href="#local-6989586621679547316"><span class="hs-identifier hs-var">cm</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CMode -&gt; CInt
</span><a href="System.Posix.Internals.html#c_s_isblk"><span class="hs-identifier hs-var">c_s_isblk</span></a></span><span> </span><span class="annot"><span class="annottext">CMode
</span><a href="#local-6989586621679547316"><span class="hs-identifier hs-var">cm</span></a></span><span> </span><span class="annot"><span class="annottext">CInt -&gt; CInt -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%2F%3D"><span class="hs-operator hs-var">/=</span></a></span><span> </span><span class="annot"><span class="annottext">CInt
</span><span class="hs-number">0</span></span><span>
</span><span id="line-541"></span><span class="annot"><a href="System.Posix.Internals.html#s_isdir"><span class="hs-identifier hs-type">s_isdir</span></a></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="System.Posix.Types.html#CMode"><span class="hs-identifier hs-type">CMode</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span>
</span><span id="line-542"></span><span id="s_isdir"><span class="annot"><span class="annottext">s_isdir :: CMode -&gt; Bool
</span><a href="System.Posix.Internals.html#s_isdir"><span class="hs-identifier hs-var hs-var">s_isdir</span></a></span></span><span> </span><span id="local-6989586621679547315"><span class="annot"><span class="annottext">CMode
</span><a href="#local-6989586621679547315"><span class="hs-identifier hs-var">cm</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CMode -&gt; CInt
</span><a href="System.Posix.Internals.html#c_s_isdir"><span class="hs-identifier hs-var">c_s_isdir</span></a></span><span> </span><span class="annot"><span class="annottext">CMode
</span><a href="#local-6989586621679547315"><span class="hs-identifier hs-var">cm</span></a></span><span> </span><span class="annot"><span class="annottext">CInt -&gt; CInt -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%2F%3D"><span class="hs-operator hs-var">/=</span></a></span><span> </span><span class="annot"><span class="annottext">CInt
</span><span class="hs-number">0</span></span><span>
</span><span id="line-543"></span><span class="annot"><a href="System.Posix.Internals.html#s_isfifo"><span class="hs-identifier hs-type">s_isfifo</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="System.Posix.Types.html#CMode"><span class="hs-identifier hs-type">CMode</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span>
</span><span id="line-544"></span><span id="s_isfifo"><span class="annot"><span class="annottext">s_isfifo :: CMode -&gt; Bool
</span><a href="System.Posix.Internals.html#s_isfifo"><span class="hs-identifier hs-var hs-var">s_isfifo</span></a></span></span><span> </span><span id="local-6989586621679547314"><span class="annot"><span class="annottext">CMode
</span><a href="#local-6989586621679547314"><span class="hs-identifier hs-var">cm</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CMode -&gt; CInt
</span><a href="System.Posix.Internals.html#c_s_isfifo"><span class="hs-identifier hs-var">c_s_isfifo</span></a></span><span> </span><span class="annot"><span class="annottext">CMode
</span><a href="#local-6989586621679547314"><span class="hs-identifier hs-var">cm</span></a></span><span> </span><span class="annot"><span class="annottext">CInt -&gt; CInt -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%2F%3D"><span class="hs-operator hs-var">/=</span></a></span><span> </span><span class="annot"><span class="annottext">CInt
</span><span class="hs-number">0</span></span><span>
</span><span id="line-545"></span><span>
</span><span id="line-546"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h __hscore_sizeof_stat&quot;</span></span><span> </span><span id="sizeof_stat"><span class="annot"><a href="System.Posix.Internals.html#sizeof_stat"><span class="hs-identifier hs-var">sizeof_stat</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>
</span><span id="line-547"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h __hscore_st_mtime&quot;</span></span><span> </span><span id="st_mtime"><span class="annot"><a href="System.Posix.Internals.html#st_mtime"><span class="hs-identifier hs-var">st_mtime</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="System.Posix.Internals.html#CStat"><span class="hs-identifier hs-type">CStat</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CTime"><span class="hs-identifier hs-type">CTime</span></a></span><span class="hs-cpp">
#if defined(mingw32_HOST_OS)
</span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h __hscore_st_size&quot;</span></span><span> </span><span id="st_size"><span class="annot"><a href="System.Posix.Internals.html#st_size"><span class="hs-identifier hs-var">st_size</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="System.Posix.Internals.html#CStat"><span class="hs-identifier hs-type">CStat</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="GHC.Int.html#Int64"><span class="hs-identifier hs-type">Int64</span></a></span><span class="hs-cpp">
#else
</span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">ccall</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;HsBase.h __hscore_st_size&quot;</span><span> </span><span class="hs-identifier">st_size</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">CStat</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">COff</span><span class="hs-cpp">
#endif
</span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h __hscore_st_mode&quot;</span></span><span> </span><span id="st_mode"><span class="annot"><a href="System.Posix.Internals.html#st_mode"><span class="hs-identifier hs-var">st_mode</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="System.Posix.Internals.html#CStat"><span class="hs-identifier hs-type">CStat</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="System.Posix.Types.html#CMode"><span class="hs-identifier hs-type">CMode</span></a></span><span>
</span><span id="line-554"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h __hscore_st_dev&quot;</span></span><span> </span><span id="st_dev"><span class="annot"><a href="System.Posix.Internals.html#st_dev"><span class="hs-identifier hs-var">st_dev</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="System.Posix.Internals.html#CStat"><span class="hs-identifier hs-type">CStat</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="System.Posix.Types.html#CDev"><span class="hs-identifier hs-type">CDev</span></a></span><span>
</span><span id="line-555"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h __hscore_st_ino&quot;</span></span><span> </span><span id="st_ino"><span class="annot"><a href="System.Posix.Internals.html#st_ino"><span class="hs-identifier hs-var">st_ino</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="System.Posix.Internals.html#CStat"><span class="hs-identifier hs-type">CStat</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="System.Posix.Types.html#CIno"><span class="hs-identifier hs-type">CIno</span></a></span><span>
</span><span id="line-556"></span><span>
</span><span id="line-557"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h __hscore_echo&quot;</span></span><span>         </span><span id="const_echo"><span class="annot"><a href="System.Posix.Internals.html#const_echo"><span class="hs-identifier hs-var">const_echo</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-558"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h __hscore_tcsanow&quot;</span></span><span>      </span><span id="const_tcsanow"><span class="annot"><a href="System.Posix.Internals.html#const_tcsanow"><span class="hs-identifier hs-var">const_tcsanow</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-559"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h __hscore_icanon&quot;</span></span><span>       </span><span id="const_icanon"><span class="annot"><a href="System.Posix.Internals.html#const_icanon"><span class="hs-identifier hs-var">const_icanon</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-560"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h __hscore_vmin&quot;</span></span><span>         </span><span id="const_vmin"><span class="annot"><a href="System.Posix.Internals.html#const_vmin"><span class="hs-identifier hs-var">const_vmin</span></a></span></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-561"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h __hscore_vtime&quot;</span></span><span>        </span><span id="const_vtime"><span class="annot"><a href="System.Posix.Internals.html#const_vtime"><span class="hs-identifier hs-var">const_vtime</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-562"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h __hscore_sigttou&quot;</span></span><span>      </span><span id="const_sigttou"><span class="annot"><a href="System.Posix.Internals.html#const_sigttou"><span class="hs-identifier hs-var">const_sigttou</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-563"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h __hscore_sig_block&quot;</span></span><span>    </span><span id="const_sig_block"><span class="annot"><a href="System.Posix.Internals.html#const_sig_block"><span class="hs-identifier hs-var">const_sig_block</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-564"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h __hscore_sig_setmask&quot;</span></span><span>  </span><span id="const_sig_setmask"><span class="annot"><a href="System.Posix.Internals.html#const_sig_setmask"><span class="hs-identifier hs-var">const_sig_setmask</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-565"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h __hscore_f_getfl&quot;</span></span><span>      </span><span id="const_f_getfl"><span class="annot"><a href="System.Posix.Internals.html#const_f_getfl"><span class="hs-identifier hs-var">const_f_getfl</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-566"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h __hscore_f_setfl&quot;</span></span><span>      </span><span id="const_f_setfl"><span class="annot"><a href="System.Posix.Internals.html#const_f_setfl"><span class="hs-identifier hs-var">const_f_setfl</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-567"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h __hscore_f_setfd&quot;</span></span><span>      </span><span id="const_f_setfd"><span class="annot"><a href="System.Posix.Internals.html#const_f_setfd"><span class="hs-identifier hs-var">const_f_setfd</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-568"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;HsBase.h __hscore_fd_cloexec&quot;</span></span><span>   </span><span id="const_fd_cloexec"><span class="annot"><a href="System.Posix.Internals.html#const_fd_cloexec"><span class="hs-identifier hs-var">const_fd_cloexec</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CLong"><span class="hs-identifier hs-type">CLong</span></a></span><span class="hs-cpp">

#if defined(HTYPE_TCFLAG_T)
</span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">ccall</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;HsBase.h __hscore_sizeof_termios&quot;</span><span>  </span><span class="hs-identifier">sizeof_termios</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Int</span><span>
</span><span id="line-572"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">ccall</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;HsBase.h __hscore_sizeof_sigset_t&quot;</span><span> </span><span class="hs-identifier">sizeof_sigset_t</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Int</span><span>
</span><span id="line-573"></span><span>
</span><span id="line-574"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">ccall</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;HsBase.h __hscore_lflag&quot;</span><span> </span><span class="hs-identifier">c_lflag</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">CTermios</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">CTcflag</span><span>
</span><span id="line-575"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">ccall</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;HsBase.h __hscore_poke_lflag&quot;</span><span> </span><span class="hs-identifier">poke_c_lflag</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">CTermios</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">CTcflag</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-576"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">ccall</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;HsBase.h __hscore_ptr_c_cc&quot;</span><span> </span><span class="hs-identifier">ptr_c_cc</span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">CTermios</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">Word8</span><span class="hs-special">)</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-579"></span><span class="annot"><a href="System.Posix.Internals.html#s_issock"><span class="hs-identifier hs-type">s_issock</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="System.Posix.Types.html#CMode"><span class="hs-identifier hs-type">CMode</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-cpp">
#if !defined(mingw32_HOST_OS)
</span><span class="hs-identifier">s_issock</span><span> </span><span class="hs-identifier">cmode</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">c_s_issock</span><span> </span><span class="hs-identifier">cmode</span><span> </span><span class="hs-operator">/=</span><span> </span><span class="hs-number">0</span><span>
</span><span id="line-582"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">capi</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;sys/stat.h S_ISSOCK&quot;</span><span> </span><span class="hs-identifier">c_s_issock</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">CMode</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">CInt</span><span class="hs-cpp">
#else
</span><span id="s_issock"><span class="annot"><span class="annottext">s_issock :: CMode -&gt; Bool
</span><a href="System.Posix.Internals.html#s_issock"><span class="hs-identifier hs-var hs-var">s_issock</span></a></span></span><span> </span><span class="annot"><span class="annottext">CMode
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#False"><span class="hs-identifier hs-var">False</span></a></span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-587"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;__hscore_bufsiz&quot;</span></span><span>  </span><span id="dEFAULT_BUFFER_SIZE"><span class="annot"><a href="System.Posix.Internals.html#dEFAULT_BUFFER_SIZE"><span class="hs-identifier hs-var">dEFAULT_BUFFER_SIZE</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>
</span><span id="line-588"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">capi</span></span><span>  </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;stdio.h value SEEK_CUR&quot;</span></span><span> </span><span id="sEEK_CUR"><span class="annot"><a href="System.Posix.Internals.html#sEEK_CUR"><span class="hs-identifier hs-var">sEEK_CUR</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-589"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">capi</span></span><span>  </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;stdio.h value SEEK_SET&quot;</span></span><span> </span><span id="sEEK_SET"><span class="annot"><a href="System.Posix.Internals.html#sEEK_SET"><span class="hs-identifier hs-var">sEEK_SET</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-590"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">capi</span></span><span>  </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;stdio.h value SEEK_END&quot;</span></span><span> </span><span id="sEEK_END"><span class="annot"><a href="System.Posix.Internals.html#sEEK_END"><span class="hs-identifier hs-var">sEEK_END</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-591"></span><span>
</span><span id="line-592"></span><span class="hs-comment">{-
Note: Windows types

Windows' _read and _write have types that differ from POSIX. They take an
unsigned int for length and return a signed int where POSIX uses size_t and
ssize_t. Those are different on x86_64 and equivalent on x86. We import them
with the types in Microsoft's documentation which means that c_read,
c_safe_read, c_write and c_safe_write have different Haskell types depending on
the OS.
-}</span><span>
</span><span id="line-602"></span><span>
</span><span id="line-603"></span></pre></body></html>